akshare 1.12.95__py3-none-any.whl → 1.15.72__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of akshare might be problematic. Click here for more details.

Files changed (240) hide show
  1. akshare/__init__.py +446 -139
  2. akshare/air/air_hebei.py +79 -53
  3. akshare/air/air_zhenqi.py +29 -43
  4. akshare/air/sunrise_tad.py +32 -17
  5. akshare/bank/bank_cbirc_2020.py +12 -9
  6. akshare/bond/bond_cb_ths.py +17 -9
  7. akshare/bond/bond_china.py +38 -39
  8. akshare/bond/bond_china_money.py +75 -48
  9. akshare/bond/bond_convert.py +40 -16
  10. akshare/bond/bond_info_cm.py +28 -8
  11. akshare/bond/bond_issue_cninfo.py +73 -30
  12. akshare/bond/{bond_zh_cov_sina.py → bond_zh_cov.py} +41 -17
  13. akshare/bond/bond_zh_sina.py +57 -51
  14. akshare/cal/__init__.py +0 -0
  15. akshare/cal/rv.py +170 -0
  16. akshare/cost/cost_living.py +7 -5
  17. akshare/currency/currency_safe.py +7 -6
  18. akshare/data/cninfo.js +15 -0
  19. akshare/datasets.py +10 -21
  20. akshare/economic/macro_bank.py +95 -653
  21. akshare/economic/macro_china.py +772 -1024
  22. akshare/economic/macro_china_hk.py +65 -243
  23. akshare/economic/macro_china_nbs.py +24 -7
  24. akshare/economic/macro_constitute.py +17 -12
  25. akshare/economic/macro_euro.py +13 -6
  26. akshare/economic/macro_finance_ths.py +133 -0
  27. akshare/economic/macro_info_ws.py +100 -0
  28. akshare/economic/macro_japan.py +5 -4
  29. akshare/economic/macro_other.py +12 -9
  30. akshare/economic/macro_usa.py +376 -1940
  31. akshare/economic/marco_cnbs.py +11 -6
  32. akshare/energy/energy_carbon.py +94 -125
  33. akshare/event/migration.py +3 -2
  34. akshare/exceptions.py +43 -0
  35. akshare/file_fold/calendar.json +245 -2
  36. akshare/fortune/fortune_500.py +15 -48
  37. akshare/fund/fund_amac.py +157 -75
  38. akshare/fund/fund_em.py +191 -184
  39. akshare/fund/fund_etf_em.py +20 -19
  40. akshare/fund/fund_etf_sina.py +71 -23
  41. akshare/fund/fund_etf_ths.py +93 -0
  42. akshare/fund/fund_fee_em.py +98 -0
  43. akshare/fund/fund_lof_em.py +10 -8
  44. akshare/fund/fund_portfolio_em.py +60 -50
  45. akshare/fund/fund_rank_em.py +91 -82
  46. akshare/fund/fund_report_cninfo.py +63 -48
  47. akshare/fund/fund_scale_sina.py +20 -10
  48. akshare/fund/fund_xq.py +139 -109
  49. akshare/futures/cons.py +8 -31
  50. akshare/futures/cot.py +185 -137
  51. akshare/futures/futures_basis.py +97 -32
  52. akshare/futures/futures_comm_ctp.py +37 -0
  53. akshare/futures/futures_comm_qihuo.py +74 -45
  54. akshare/futures/futures_daily_bar.py +121 -184
  55. akshare/futures/futures_hf_em.py +66 -61
  56. akshare/futures/futures_hq_sina.py +79 -61
  57. akshare/futures/futures_index_ccidx.py +6 -3
  58. akshare/futures/futures_inventory_99.py +61 -272
  59. akshare/futures/futures_news_shmet.py +4 -2
  60. akshare/futures/futures_roll_yield.py +12 -25
  61. akshare/futures/futures_spot_stock_em.py +19 -13
  62. akshare/futures/futures_stock_js.py +14 -12
  63. akshare/futures/futures_to_spot.py +38 -33
  64. akshare/futures/futures_warehouse_receipt.py +75 -71
  65. akshare/futures/futures_zh_sina.py +73 -50
  66. akshare/futures/symbol_var.py +18 -13
  67. akshare/futures_derivative/futures_contract_info_czce.py +60 -52
  68. akshare/futures_derivative/futures_contract_info_ine.py +43 -34
  69. akshare/futures_derivative/futures_contract_info_shfe.py +46 -35
  70. akshare/futures_derivative/futures_cot_sina.py +26 -19
  71. akshare/futures_derivative/futures_spot_sys.py +21 -8
  72. akshare/fx/currency_investing.py +19 -285
  73. akshare/index/index_cflp.py +29 -26
  74. akshare/index/index_cni.py +86 -88
  75. akshare/index/index_cons.py +26 -10
  76. akshare/index/index_cx.py +248 -47
  77. akshare/index/index_drewry.py +17 -16
  78. akshare/index/index_hog.py +27 -26
  79. akshare/index/index_option_qvix.py +329 -0
  80. akshare/index/index_research_fund_sw.py +134 -0
  81. akshare/index/{index_sw_research.py → index_research_sw.py} +122 -58
  82. akshare/index/index_spot.py +9 -5
  83. akshare/index/index_stock_hk.py +35 -16
  84. akshare/index/index_stock_us_sina.py +1 -1
  85. akshare/index/index_stock_zh.py +180 -89
  86. akshare/index/index_stock_zh_csindex.py +15 -369
  87. akshare/index/index_sw.py +62 -34
  88. akshare/index/index_yw.py +46 -23
  89. akshare/index/index_zh_a_scope.py +48 -0
  90. akshare/index/index_zh_em.py +17 -14
  91. akshare/interest_rate/interbank_rate_em.py +14 -9
  92. akshare/movie/artist_yien.py +32 -5
  93. akshare/movie/movie_yien.py +92 -18
  94. akshare/movie/video_yien.py +28 -5
  95. akshare/news/news_baidu.py +78 -44
  96. akshare/news/news_cctv.py +38 -38
  97. akshare/news/news_stock.py +6 -3
  98. akshare/nlp/nlp_interface.py +7 -8
  99. akshare/option/cons.py +11 -11
  100. akshare/option/option_comm_qihuo.py +86 -0
  101. akshare/option/option_commodity.py +178 -51
  102. akshare/option/option_daily_stats_sse_szse.py +146 -0
  103. akshare/option/option_em.py +147 -138
  104. akshare/option/option_finance_sina.py +160 -137
  105. akshare/option/option_lhb_em.py +62 -56
  106. akshare/option/option_risk_indicator_sse.py +17 -14
  107. akshare/other/other_car_cpca.py +934 -0
  108. akshare/other/{other_car.py → other_car_gasgoo.py} +15 -54
  109. akshare/qdii/__init__.py +0 -0
  110. akshare/qdii/qdii_jsl.py +233 -0
  111. akshare/request.py +117 -0
  112. akshare/spot/spot_hog_soozhu.py +232 -0
  113. akshare/spot/spot_price_qh.py +121 -0
  114. akshare/spot/spot_sge.py +63 -10
  115. akshare/stock/stock_allotment_cninfo.py +10 -9
  116. akshare/stock/stock_ask_bid_em.py +27 -3
  117. akshare/stock/stock_board_concept_em.py +23 -14
  118. akshare/stock/stock_board_industry_em.py +40 -34
  119. akshare/stock/stock_cg_equity_mortgage.py +15 -11
  120. akshare/stock/stock_cg_guarantee.py +41 -51
  121. akshare/stock/stock_cg_lawsuit.py +36 -35
  122. akshare/stock/stock_dividend_cninfo.py +12 -6
  123. akshare/stock/stock_dzjy_em.py +347 -260
  124. akshare/stock/stock_fund_em.py +332 -84
  125. akshare/stock/stock_hk_famous.py +108 -0
  126. akshare/stock/stock_hk_sina.py +8 -7
  127. akshare/stock/stock_hold_control_cninfo.py +100 -15
  128. akshare/stock/stock_hold_control_em.py +4 -3
  129. akshare/stock/stock_hold_num_cninfo.py +18 -12
  130. akshare/stock/stock_hot_rank_em.py +2 -1
  131. akshare/stock/stock_hot_search_baidu.py +5 -2
  132. akshare/stock/stock_industry_cninfo.py +24 -18
  133. akshare/stock/stock_industry_pe_cninfo.py +45 -31
  134. akshare/stock/stock_industry_sw.py +9 -10
  135. akshare/stock/stock_info.py +25 -15
  136. akshare/stock/stock_info_em.py +5 -2
  137. akshare/stock/stock_intraday_em.py +5 -2
  138. akshare/stock/stock_intraday_sina.py +22 -18
  139. akshare/stock/stock_ipo_summary_cninfo.py +25 -10
  140. akshare/stock/stock_new_cninfo.py +32 -19
  141. akshare/stock/stock_news_cx.py +39 -0
  142. akshare/stock/stock_profile_cninfo.py +9 -8
  143. akshare/stock/stock_rank_forecast.py +8 -6
  144. akshare/stock/stock_share_changes_cninfo.py +18 -14
  145. akshare/stock/stock_share_hold.py +24 -19
  146. akshare/stock/stock_summary.py +54 -26
  147. akshare/stock/stock_us_famous.py +15 -6
  148. akshare/stock/stock_us_pink.py +7 -5
  149. akshare/stock/stock_us_sina.py +15 -12
  150. akshare/stock/stock_xq.py +38 -12
  151. akshare/stock/stock_zh_a_sina.py +53 -78
  152. akshare/stock/stock_zh_b_sina.py +32 -55
  153. akshare/stock/stock_zh_kcb_report.py +11 -9
  154. akshare/stock/stock_zh_kcb_sina.py +67 -64
  155. akshare/stock_feature/stock_a_below_net_asset_statistics.py +5 -2
  156. akshare/stock_feature/stock_a_high_low.py +5 -2
  157. akshare/stock_feature/stock_a_indicator.py +12 -9
  158. akshare/stock_feature/stock_a_pe_and_pb.py +27 -6
  159. akshare/stock_feature/stock_account_em.py +58 -40
  160. akshare/stock_feature/stock_analyst_em.py +36 -27
  161. akshare/stock_feature/stock_board_industry_ths.py +136 -400
  162. akshare/stock_feature/stock_comment_em.py +118 -85
  163. akshare/stock_feature/stock_concept_futu.py +183 -0
  164. akshare/stock_feature/stock_cyq_em.py +58 -54
  165. akshare/stock_feature/stock_disclosure_cninfo.py +147 -102
  166. akshare/stock_feature/stock_esg_sina.py +216 -11
  167. akshare/stock_feature/stock_fhps_em.py +60 -25
  168. akshare/stock_feature/stock_fhps_ths.py +25 -6
  169. akshare/stock_feature/stock_fund_flow.py +38 -25
  170. akshare/stock_feature/stock_gdfx_em.py +180 -95
  171. akshare/stock_feature/stock_gdhs.py +73 -49
  172. akshare/stock_feature/stock_gpzy_em.py +78 -46
  173. akshare/stock_feature/stock_hist_em.py +164 -111
  174. akshare/stock_feature/stock_hk_valuation_baidu.py +20 -8
  175. akshare/stock_feature/stock_hsgt_em.py +184 -452
  176. akshare/stock_feature/stock_info.py +52 -29
  177. akshare/stock_feature/stock_inner_trade_xq.py +39 -31
  178. akshare/stock_feature/stock_irm_cninfo.py +32 -9
  179. akshare/stock_feature/stock_jgdy_em.py +41 -38
  180. akshare/stock_feature/stock_lh_yybpm.py +36 -37
  181. akshare/stock_feature/stock_lhb_em.py +135 -71
  182. akshare/stock_feature/stock_lhb_sina.py +93 -46
  183. akshare/stock_feature/stock_margin_em.py +102 -0
  184. akshare/stock_feature/{stock_sse_margin.py → stock_margin_sse.py} +21 -15
  185. akshare/stock_feature/{stock_szse_margin.py → stock_margin_szse.py} +23 -19
  186. akshare/stock_feature/stock_market_legu.py +13 -8
  187. akshare/stock_feature/stock_pankou_em.py +72 -34
  188. akshare/stock_feature/stock_report_em.py +244 -54
  189. akshare/stock_feature/stock_research_report_em.py +48 -19
  190. akshare/stock_feature/stock_sns_sseinfo.py +15 -12
  191. akshare/stock_feature/stock_sy_em.py +86 -33
  192. akshare/stock_feature/stock_technology_ths.py +152 -120
  193. akshare/stock_feature/stock_tfp_em.py +35 -13
  194. akshare/stock_feature/stock_three_report_em.py +119 -77
  195. akshare/stock_feature/stock_ttm_lyr.py +4 -7
  196. akshare/stock_feature/stock_value_em.py +83 -0
  197. akshare/stock_feature/stock_wencai.py +21 -9
  198. akshare/stock_feature/stock_yjyg_em.py +63 -28
  199. akshare/stock_feature/stock_zf_pg.py +61 -38
  200. akshare/stock_feature/stock_zh_valuation_baidu.py +3 -2
  201. akshare/stock_feature/stock_ztb_em.py +62 -40
  202. akshare/stock_fundamental/stock_finance.py +150 -58
  203. akshare/stock_fundamental/stock_finance_ths.py +116 -31
  204. akshare/stock_fundamental/stock_mda_ym.py +5 -3
  205. akshare/stock_fundamental/stock_notice.py +29 -15
  206. akshare/stock_fundamental/stock_profit_forecast_em.py +31 -13
  207. akshare/stock_fundamental/stock_profit_forecast_ths.py +19 -10
  208. akshare/stock_fundamental/stock_register_em.py +448 -0
  209. akshare/stock_fundamental/stock_restricted_em.py +79 -32
  210. akshare/stock_fundamental/stock_zygc.py +10 -8
  211. akshare/stock_fundamental/stock_zyjs_ths.py +5 -3
  212. akshare/tool/trade_date_hist.py +4 -3
  213. akshare/utils/cons.py +10 -0
  214. akshare/utils/context.py +43 -0
  215. akshare/utils/demjson.py +2 -2
  216. akshare/utils/func.py +26 -0
  217. akshare/utils/tqdm.py +13 -3
  218. {akshare-1.12.95.dist-info → akshare-1.15.72.dist-info}/METADATA +52 -69
  219. akshare-1.15.72.dist-info/RECORD +385 -0
  220. {akshare-1.12.95.dist-info → akshare-1.15.72.dist-info}/WHEEL +1 -1
  221. tests/test_func.py +3 -5
  222. akshare/bond/bond_futures.py +0 -50
  223. akshare/bond/bond_investing.py +0 -139
  224. akshare/crypto/crypto_hist_investing.py +0 -249
  225. akshare/fortune/fortune_it_juzi.py +0 -123
  226. akshare/futures/futures_international.py +0 -170
  227. akshare/futures/futures_news_baidu.py +0 -54
  228. akshare/futures/inventory_data.py +0 -100
  229. akshare/futures_derivative/futures_index_price_nh.py +0 -61
  230. akshare/futures_derivative/futures_index_return_nh.py +0 -47
  231. akshare/futures_derivative/futures_index_volatility_nh.py +0 -51
  232. akshare/futures_derivative/futures_other_index_nh.py +0 -145
  233. akshare/index/index_fear_greed_funddb.py +0 -71
  234. akshare/index/index_investing.py +0 -232
  235. akshare/sport/sport_olympic_winter.py +0 -39
  236. akshare/stock_feature/stock_board_concept_ths.py +0 -422
  237. akshare/stock_fundamental/stock_register.py +0 -292
  238. akshare-1.12.95.dist-info/RECORD +0 -374
  239. {akshare-1.12.95.dist-info → akshare-1.15.72.dist-info}/LICENSE +0 -0
  240. {akshare-1.12.95.dist-info → akshare-1.15.72.dist-info}/top_level.txt +0 -0
@@ -1,10 +1,11 @@
1
1
  #!/usr/bin/env python
2
2
  # -*- coding:utf-8 -*-
3
3
  """
4
- Date: 2024/2/26 15:00
4
+ Date: 2024/5/10 00:00
5
5
  Desc: 新浪财经-龙虎榜
6
6
  https://vip.stock.finance.sina.com.cn/q/go.php/vInvestConsult/kind/lhb/index.phtml
7
7
  """
8
+
8
9
  from io import StringIO
9
10
 
10
11
  import pandas as pd
@@ -39,16 +40,27 @@ def stock_lhb_detail_daily_sina(date: str = "20240222") -> pd.DataFrame:
39
40
  big_df = pd.concat(objs=[big_df, temp_df], ignore_index=True)
40
41
  big_df["股票代码"] = big_df["股票代码"].astype(str).str.zfill(6)
41
42
  del big_df["查看详情"]
42
- big_df.columns = ["序号", "股票代码", "股票名称", "收盘价", "对应值", "成交量", "成交额", "指标"]
43
- big_df['收盘价'] = pd.to_numeric(big_df['收盘价'], errors="coerce")
44
- big_df['对应值'] = pd.to_numeric(big_df['对应值'], errors="coerce")
45
- big_df['成交量'] = pd.to_numeric(big_df['成交量'], errors="coerce")
46
- big_df['成交额'] = pd.to_numeric(big_df['成交额'], errors="coerce")
43
+ big_df.columns = [
44
+ "序号",
45
+ "股票代码",
46
+ "股票名称",
47
+ "收盘价",
48
+ "对应值",
49
+ "成交量",
50
+ "成交额",
51
+ "指标",
52
+ ]
53
+ big_df["收盘价"] = pd.to_numeric(big_df["收盘价"], errors="coerce")
54
+ big_df["对应值"] = pd.to_numeric(big_df["对应值"], errors="coerce")
55
+ big_df["成交量"] = pd.to_numeric(big_df["成交量"], errors="coerce")
56
+ big_df["成交额"] = pd.to_numeric(big_df["成交额"], errors="coerce")
47
57
  return big_df
48
58
 
49
59
 
50
- def _find_last_page(url: str = "https://vip.stock.finance.sina.com.cn/q/go.php/vLHBData/kind/ggtj/index.phtml",
51
- recent_day: str = "60"):
60
+ def _find_last_page(
61
+ url: str = "https://vip.stock.finance.sina.com.cn/q/go.php/vLHBData/kind/ggtj/index.phtml",
62
+ recent_day: str = "60",
63
+ ):
52
64
  params = {
53
65
  "last": recent_day,
54
66
  "p": "1",
@@ -57,7 +69,7 @@ def _find_last_page(url: str = "https://vip.stock.finance.sina.com.cn/q/go.php/v
57
69
  soup = BeautifulSoup(r.text, "lxml")
58
70
  try:
59
71
  previous_page = int(soup.find_all(attrs={"class": "page"})[-2].text)
60
- except Exception as e:
72
+ except: # noqa: E722
61
73
  previous_page = 1
62
74
  if previous_page != 1:
63
75
  while True:
@@ -66,7 +78,7 @@ def _find_last_page(url: str = "https://vip.stock.finance.sina.com.cn/q/go.php/v
66
78
  "p": previous_page,
67
79
  }
68
80
  r = requests.get(url, params=params)
69
- soup = BeautifulSoup(r.text, "lxml")
81
+ soup = BeautifulSoup(r.text, features="lxml")
70
82
  last_page = int(soup.find_all(attrs={"class": "page"})[-2].text)
71
83
  if last_page != previous_page:
72
84
  previous_page = last_page
@@ -76,44 +88,56 @@ def _find_last_page(url: str = "https://vip.stock.finance.sina.com.cn/q/go.php/v
76
88
  return previous_page
77
89
 
78
90
 
79
- def stock_lhb_ggtj_sina(recent_day: str = "30") -> pd.DataFrame:
91
+ def stock_lhb_ggtj_sina(symbol: str = "5") -> pd.DataFrame:
80
92
  """
81
93
  龙虎榜-个股上榜统计
82
94
  https://vip.stock.finance.sina.com.cn/q/go.php/vLHBData/kind/ggtj/index.phtml
83
- :param recent_day: choice of {"5": 最近 5 天; "10": 最近 10 天; "30": 最近 30 天; "60": 最近 60 天;}
84
- :type recent_day: str
85
- :return: 龙虎榜-每日详情
95
+ :param symbol: choice of {"5": 最近 5 天; "10": 最近 10 天; "30": 最近 30 天; "60": 最近 60 天;}
96
+ :type symbol: str
97
+ :return: 龙虎榜-个股上榜统计
86
98
  :rtype: pandas.DataFrame
87
99
  """
88
- url = "https://vip.stock.finance.sina.com.cn/q/go.php/vLHBData/kind/ggtj/index.phtml"
89
- last_page_num = _find_last_page(url, recent_day)
100
+ url = (
101
+ "https://vip.stock.finance.sina.com.cn/q/go.php/vLHBData/kind/ggtj/index.phtml"
102
+ )
103
+ last_page_num = _find_last_page(url, symbol)
90
104
  big_df = pd.DataFrame()
91
105
  tqdm = get_tqdm()
92
106
  for page in tqdm(range(1, last_page_num + 1), leave=False):
93
107
  params = {
94
- "last": recent_day,
108
+ "last": symbol,
95
109
  "p": page,
96
110
  }
97
111
  r = requests.get(url, params=params)
98
112
  temp_df = pd.read_html(StringIO(r.text))[0].iloc[0:, :]
99
- big_df = pd.concat([big_df, temp_df], ignore_index=True)
113
+ big_df = pd.concat(objs=[big_df, temp_df], ignore_index=True)
100
114
  big_df["股票代码"] = big_df["股票代码"].astype(str).str.zfill(6)
101
- big_df.columns = ["股票代码", "股票名称", "上榜次数", "累积购买额", "累积卖出额", "净额", "买入席位数",
102
- "卖出席位数"]
115
+ big_df.columns = [
116
+ "股票代码",
117
+ "股票名称",
118
+ "上榜次数",
119
+ "累积购买额",
120
+ "累积卖出额",
121
+ "净额",
122
+ "买入席位数",
123
+ "卖出席位数",
124
+ ]
103
125
  return big_df
104
126
 
105
127
 
106
- def stock_lhb_yytj_sina(recent_day: str = "5") -> pd.DataFrame:
128
+ def stock_lhb_yytj_sina(symbol: str = "5") -> pd.DataFrame:
107
129
  """
108
130
  龙虎榜-营业部上榜统计
109
131
  https://vip.stock.finance.sina.com.cn/q/go.php/vLHBData/kind/yytj/index.phtml
110
- :param recent_day: choice of {"5": 最近 5 天; "10": 最近 10 天; "30": 最近 30 天; "60": 最近 60 天;}
111
- :type recent_day: str
132
+ :param symbol: choice of {"5": 最近 5 天; "10": 最近 10 天; "30": 最近 30 天; "60": 最近 60 天;}
133
+ :type symbol: str
112
134
  :return: 龙虎榜-营业部上榜统计
113
135
  :rtype: pandas.DataFrame
114
136
  """
115
- url = "https://vip.stock.finance.sina.com.cn/q/go.php/vLHBData/kind/yytj/index.phtml"
116
- last_page_num = _find_last_page(url, recent_day)
137
+ url = (
138
+ "https://vip.stock.finance.sina.com.cn/q/go.php/vLHBData/kind/yytj/index.phtml"
139
+ )
140
+ last_page_num = _find_last_page(url, symbol)
117
141
  big_df = pd.DataFrame()
118
142
  tqdm = get_tqdm()
119
143
  for page in tqdm(range(1, last_page_num + 1), leave=False):
@@ -124,29 +148,39 @@ def stock_lhb_yytj_sina(recent_day: str = "5") -> pd.DataFrame:
124
148
  r = requests.get(url, params=params)
125
149
  temp_df = pd.read_html(StringIO(r.text))[0].iloc[0:, :]
126
150
  big_df = pd.concat([big_df, temp_df], ignore_index=True)
127
- big_df.columns = ["营业部名称", "上榜次数", "累积购买额", "买入席位数", "累积卖出额", "卖出席位数", "买入前三股票"]
151
+ big_df.columns = [
152
+ "营业部名称",
153
+ "上榜次数",
154
+ "累积购买额",
155
+ "买入席位数",
156
+ "累积卖出额",
157
+ "卖出席位数",
158
+ "买入前三股票",
159
+ ]
128
160
  big_df["上榜次数"] = pd.to_numeric(big_df["上榜次数"], errors="coerce")
129
161
  big_df["买入席位数"] = pd.to_numeric(big_df["买入席位数"], errors="coerce")
130
162
  big_df["卖出席位数"] = pd.to_numeric(big_df["卖出席位数"], errors="coerce")
131
163
  return big_df
132
164
 
133
165
 
134
- def stock_lhb_jgzz_sina(recent_day: str = "5") -> pd.DataFrame:
166
+ def stock_lhb_jgzz_sina(symbol: str = "5") -> pd.DataFrame:
135
167
  """
136
168
  龙虎榜-机构席位追踪
137
169
  https://vip.stock.finance.sina.com.cn/q/go.php/vLHBData/kind/jgzz/index.phtml
138
- :param recent_day: choice of {"5": 最近 5 天; "10": 最近 10 天; "30": 最近 30 天; "60": 最近 60 天;}
139
- :type recent_day: str
170
+ :param symbol: choice of {"5": 最近 5 天; "10": 最近 10 天; "30": 最近 30 天; "60": 最近 60 天;}
171
+ :type symbol: str
140
172
  :return: 龙虎榜-机构席位追踪
141
173
  :rtype: pandas.DataFrame
142
174
  """
143
- url = "https://vip.stock.finance.sina.com.cn/q/go.php/vLHBData/kind/jgzz/index.phtml"
144
- last_page_num = _find_last_page(url, recent_day)
175
+ url = (
176
+ "https://vip.stock.finance.sina.com.cn/q/go.php/vLHBData/kind/jgzz/index.phtml"
177
+ )
178
+ last_page_num = _find_last_page(url, symbol)
145
179
  big_df = pd.DataFrame()
146
180
  tqdm = get_tqdm()
147
181
  for page in tqdm(range(1, last_page_num + 1), leave=False):
148
182
  params = {
149
- "last": recent_day,
183
+ "last": symbol,
150
184
  "p": page,
151
185
  }
152
186
  r = requests.get(url, params=params)
@@ -157,7 +191,15 @@ def stock_lhb_jgzz_sina(recent_day: str = "5") -> pd.DataFrame:
157
191
  big_df["股票代码"] = big_df["股票代码"].astype(str).str.zfill(6)
158
192
  del big_df["当前价"]
159
193
  del big_df["涨跌幅"]
160
- big_df.columns = ["股票代码", "股票名称", "累积买入额", "买入次数", "累积卖出额", "卖出次数", "净额"]
194
+ big_df.columns = [
195
+ "股票代码",
196
+ "股票名称",
197
+ "累积买入额",
198
+ "买入次数",
199
+ "累积卖出额",
200
+ "卖出次数",
201
+ "净额",
202
+ ]
161
203
  big_df["买入次数"] = pd.to_numeric(big_df["买入次数"], errors="coerce")
162
204
  big_df["卖出次数"] = pd.to_numeric(big_df["卖出次数"], errors="coerce")
163
205
  return big_df
@@ -170,7 +212,9 @@ def stock_lhb_jgmx_sina() -> pd.DataFrame:
170
212
  :return: 龙虎榜-机构席位成交明细
171
213
  :rtype: pandas.DataFrame
172
214
  """
173
- url = "https://vip.stock.finance.sina.com.cn/q/go.php/vLHBData/kind/jgmx/index.phtml"
215
+ url = (
216
+ "https://vip.stock.finance.sina.com.cn/q/go.php/vLHBData/kind/jgmx/index.phtml"
217
+ )
174
218
  params = {
175
219
  "p": "1",
176
220
  }
@@ -178,7 +222,7 @@ def stock_lhb_jgmx_sina() -> pd.DataFrame:
178
222
  soup = BeautifulSoup(r.text, features="lxml")
179
223
  try:
180
224
  last_page_num = int(soup.find_all(attrs={"class": "page"})[-2].text)
181
- except:
225
+ except: # noqa: E722
182
226
  last_page_num = 1
183
227
  big_df = pd.DataFrame()
184
228
  tqdm = get_tqdm()
@@ -190,27 +234,30 @@ def stock_lhb_jgmx_sina() -> pd.DataFrame:
190
234
  temp_df = pd.read_html(StringIO(r.text))[0].iloc[0:, :]
191
235
  big_df = pd.concat(objs=[big_df, temp_df], ignore_index=True)
192
236
  big_df["股票代码"] = big_df["股票代码"].astype(str).str.zfill(6)
193
- big_df['交易日期'] = pd.to_datetime(big_df['交易日期'], errors="coerce").dt.date
194
- big_df.rename(columns={"机构席位买入额(万)": "机构席位买入额", "机构席位卖出额(万)": "机构席位卖出额"},
195
- inplace=True)
196
- big_df['机构席位买入额'] = pd.to_numeric(big_df['机构席位买入额'], errors="coerce")
197
- big_df['机构席位卖出额'] = pd.to_numeric(big_df['机构席位卖出额'], errors="coerce")
237
+ big_df["交易日期"] = pd.to_datetime(big_df["交易日期"], errors="coerce").dt.date
238
+ big_df.rename(
239
+ columns={
240
+ "机构席位买入额(万)": "机构席位买入额",
241
+ "机构席位卖出额(万)": "机构席位卖出额",
242
+ },
243
+ inplace=True,
244
+ )
245
+ big_df["机构席位买入额"] = pd.to_numeric(big_df["机构席位买入额"], errors="coerce")
246
+ big_df["机构席位卖出额"] = pd.to_numeric(big_df["机构席位卖出额"], errors="coerce")
198
247
  return big_df
199
248
 
200
249
 
201
250
  if __name__ == "__main__":
202
- stock_lhb_detail_daily_sina_df = stock_lhb_detail_daily_sina(
203
- date="20240222"
204
- )
251
+ stock_lhb_detail_daily_sina_df = stock_lhb_detail_daily_sina(date="20240222")
205
252
  print(stock_lhb_detail_daily_sina_df)
206
253
 
207
- stock_lhb_ggtj_sina_df = stock_lhb_ggtj_sina(recent_day="5")
254
+ stock_lhb_ggtj_sina_df = stock_lhb_ggtj_sina(symbol="5")
208
255
  print(stock_lhb_ggtj_sina_df)
209
256
 
210
- stock_lhb_yytj_sina_df = stock_lhb_yytj_sina(recent_day="5")
257
+ stock_lhb_yytj_sina_df = stock_lhb_yytj_sina(symbol="5")
211
258
  print(stock_lhb_yytj_sina_df)
212
259
 
213
- stock_lhb_jgzz_sina_df = stock_lhb_jgzz_sina(recent_day="5")
260
+ stock_lhb_jgzz_sina_df = stock_lhb_jgzz_sina(symbol="5")
214
261
  print(stock_lhb_jgzz_sina_df)
215
262
 
216
263
  stock_lhb_jgmx_sina_df = stock_lhb_jgmx_sina()
@@ -0,0 +1,102 @@
1
+ #!/usr/bin/env python
2
+ # -*- coding:utf-8 -*-
3
+ """
4
+ Date: 2024/6/14 17:00
5
+ Desc: 东方财富网-数据中心-融资融券-融资融券账户统计-两融账户信息
6
+ https://www.szse.cn/disclosure/margin/object/index.html
7
+ """
8
+
9
+ import pandas as pd
10
+ import requests
11
+
12
+ from akshare.utils.tqdm import get_tqdm
13
+
14
+
15
+ def stock_margin_account_info() -> pd.DataFrame:
16
+ """
17
+ 东方财富网-数据中心-融资融券-融资融券账户统计-两融账户信息
18
+ https://data.eastmoney.com/rzrq/zhtjday.html
19
+ :return: 融资融券账户统计
20
+ :rtype: pandas.DataFrame
21
+ """
22
+ import warnings
23
+
24
+ warnings.filterwarnings(action="ignore", category=FutureWarning)
25
+ url = "https://datacenter-web.eastmoney.com/api/data/v1/get"
26
+ params = {
27
+ "reportName": "RPTA_WEB_MARGIN_DAILYTRADE",
28
+ "columns": "ALL",
29
+ "pageNumber": "1",
30
+ "pageSize": "500",
31
+ "sortColumns": "STATISTICS_DATE",
32
+ "sortTypes": "-1",
33
+ "p": "1",
34
+ "pageNo": "1",
35
+ "pageNum": "1",
36
+ "_": "1718357149317",
37
+ }
38
+ r = requests.get(url=url, params=params)
39
+ data_json = r.json()
40
+ total_page = data_json["result"]["pages"]
41
+ tqdm = get_tqdm()
42
+ big_df = pd.DataFrame()
43
+ for page in tqdm(range(1, total_page + 1), leave=False):
44
+ params.update(
45
+ {
46
+ "pageNumber": page,
47
+ "p": page,
48
+ "pageNo": page,
49
+ "pageNum": page,
50
+ }
51
+ )
52
+ r = requests.get(url=url, params=params)
53
+ data_json = r.json()
54
+ temp_df = pd.DataFrame(data_json["result"]["data"])
55
+ big_df = pd.concat(objs=[big_df, temp_df], ignore_index=True)
56
+
57
+ big_df.rename(
58
+ columns={
59
+ "STATISTICS_DATE": "日期",
60
+ "FIN_BALANCE": "融资余额",
61
+ "LOAN_BALANCE": "融券余额",
62
+ "FIN_BUY_AMT": "融资买入额",
63
+ "LOAN_SELL_AMT": "融券卖出额",
64
+ "SECURITY_ORG_NUM": "证券公司数量",
65
+ "OPERATEDEPT_NUM": "营业部数量",
66
+ "PERSONAL_INVESTOR_NUM": "个人投资者数量",
67
+ "ORG_INVESTOR_NUM": "机构投资者数量",
68
+ "INVESTOR_NUM": "参与交易的投资者数量",
69
+ "MARGINLIAB_INVESTOR_NUM": "有融资融券负债的投资者数量",
70
+ "TOTAL_GUARANTEE": "担保物总价值",
71
+ "AVG_GUARANTEE_RATIO": "平均维持担保比例",
72
+ },
73
+ inplace=True,
74
+ )
75
+ big_df = big_df[
76
+ [
77
+ "日期",
78
+ "融资余额",
79
+ "融券余额",
80
+ "融资买入额",
81
+ "融券卖出额",
82
+ "证券公司数量",
83
+ "营业部数量",
84
+ "个人投资者数量",
85
+ "机构投资者数量",
86
+ "参与交易的投资者数量",
87
+ "有融资融券负债的投资者数量",
88
+ "担保物总价值",
89
+ "平均维持担保比例",
90
+ ]
91
+ ]
92
+
93
+ big_df["日期"] = pd.to_datetime(big_df["日期"], errors="coerce").dt.date
94
+ for item in big_df.columns[1:]:
95
+ big_df[item] = pd.to_numeric(big_df[item], errors="coerce")
96
+ big_df.sort_values(["日期"], ignore_index=True, inplace=True)
97
+ return big_df
98
+
99
+
100
+ if __name__ == "__main__":
101
+ stock_margin_account_info_df = stock_margin_account_info()
102
+ print(stock_margin_account_info_df)
@@ -1,10 +1,11 @@
1
1
  #!/usr/bin/env python
2
2
  # -*- coding:utf-8 -*-
3
3
  """
4
- Date: 2023/9/24 15:30
4
+ Date: 2024/6/14 17:20
5
5
  Desc: 上海证券交易所-融资融券数据
6
- http://www.sse.com.cn/market/othersdata/margin/sum/
6
+ https://www.sse.com.cn/market/othersdata/margin/sum/
7
7
  """
8
+
8
9
  import pandas as pd
9
10
  import requests
10
11
 
@@ -41,16 +42,19 @@ def stock_margin_ratio_pa(date: str = "20231013") -> pd.DataFrame:
41
42
  "secuCode": "证券代码",
42
43
  "secuName": "证券简称",
43
44
  "slMarginRatio": "融券比例",
44
- }, inplace=True
45
+ },
46
+ inplace=True,
45
47
  )
46
- temp_df = temp_df[[
48
+ temp_df = temp_df[
49
+ [
47
50
  "证券代码",
48
51
  "证券简称",
49
52
  "融资比例",
50
53
  "融券比例",
51
- ]]
52
- temp_df['融资比例'] = pd.to_numeric(temp_df['融资比例'], errors="coerce")
53
- temp_df['融券比例'] = pd.to_numeric(temp_df['融券比例'], errors="coerce")
54
+ ]
55
+ ]
56
+ temp_df["融资比例"] = pd.to_numeric(temp_df["融资比例"], errors="coerce")
57
+ temp_df["融券比例"] = pd.to_numeric(temp_df["融券比例"], errors="coerce")
54
58
  return temp_df
55
59
 
56
60
 
@@ -59,7 +63,7 @@ def stock_margin_sse(
59
63
  ) -> pd.DataFrame:
60
64
  """
61
65
  上海证券交易所-融资融券数据-融资融券汇总
62
- http://www.sse.com.cn/market/othersdata/margin/sum/
66
+ https://www.sse.com.cn/market/othersdata/margin/sum/
63
67
  :param start_date: 交易开始日期
64
68
  :type start_date: str
65
69
  :param end_date: 交易结束日期
@@ -67,7 +71,7 @@ def stock_margin_sse(
67
71
  :return: 融资融券汇总
68
72
  :rtype: pandas.DataFrame
69
73
  """
70
- url = "http://query.sse.com.cn/marketdata/tradedata/queryMargin.do"
74
+ url = "https://query.sse.com.cn/marketdata/tradedata/queryMargin.do"
71
75
  params = {
72
76
  "isPagination": "true",
73
77
  "beginDate": start_date,
@@ -82,8 +86,9 @@ def stock_margin_sse(
82
86
  "_": "1612773448860",
83
87
  }
84
88
  headers = {
85
- "Referer": "http://www.sse.com.cn/",
86
- "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.150 Safari/537.36",
89
+ "Referer": "https://www.sse.com.cn/",
90
+ "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) "
91
+ "Chrome/88.0.4324.150 Safari/537.36",
87
92
  }
88
93
  r = requests.get(url, params=params, headers=headers)
89
94
  data_json = r.json()
@@ -126,13 +131,13 @@ def stock_margin_sse(
126
131
  def stock_margin_detail_sse(date: str = "20230922") -> pd.DataFrame:
127
132
  """
128
133
  上海证券交易所-融资融券数据-融资融券明细
129
- http://www.sse.com.cn/market/othersdata/margin/detail/
134
+ https://www.sse.com.cn/market/othersdata/margin/detail/
130
135
  :param date: 交易日期
131
136
  :type date: str
132
137
  :return: 融资融券明细
133
138
  :rtype: pandas.DataFrame
134
139
  """
135
- url = "http://query.sse.com.cn/marketdata/tradedata/queryMargin.do"
140
+ url = "https://query.sse.com.cn/marketdata/tradedata/queryMargin.do"
136
141
  params = {
137
142
  "isPagination": "true",
138
143
  "tabType": "mxtype",
@@ -149,8 +154,9 @@ def stock_margin_detail_sse(date: str = "20230922") -> pd.DataFrame:
149
154
  "_": "1612773448860",
150
155
  }
151
156
  headers = {
152
- "Referer": "http://www.sse.com.cn/",
153
- "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.150 Safari/537.36",
157
+ "Referer": "https://www.sse.com.cn/",
158
+ "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) "
159
+ "Chrome/88.0.4324.150 Safari/537.36",
154
160
  }
155
161
  r = requests.get(url, params=params, headers=headers)
156
162
  data_json = r.json()
@@ -1,10 +1,11 @@
1
1
  #!/usr/bin/env python
2
2
  # -*- coding:utf-8 -*-
3
3
  """
4
- Date: 2023/10/9 15:00
4
+ Date: 2024/6/14 17:00
5
5
  Desc: 深圳证券交易所-融资融券数据
6
6
  https://www.szse.cn/disclosure/margin/object/index.html
7
7
  """
8
+
8
9
  import warnings
9
10
 
10
11
  import pandas as pd
@@ -20,7 +21,7 @@ def stock_margin_underlying_info_szse(date: str = "20221129") -> pd.DataFrame:
20
21
  :return: 标的证券信息
21
22
  :rtype: pandas.DataFrame
22
23
  """
23
- url = "http://www.szse.cn/api/report/ShowReport"
24
+ url = "https://www.szse.cn/api/report/ShowReport"
24
25
  params = {
25
26
  "SHOWTYPE": "xlsx",
26
27
  "CATALOGID": "1834_xxpl",
@@ -30,8 +31,9 @@ def stock_margin_underlying_info_szse(date: str = "20221129") -> pd.DataFrame:
30
31
  "TABKEY": "tab1",
31
32
  }
32
33
  headers = {
33
- "Referer": "http://www.szse.cn/disclosure/margin/object/index.html",
34
- "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.150 Safari/537.36",
34
+ "Referer": "https://www.szse.cn/disclosure/margin/object/index.html",
35
+ "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) "
36
+ "Chrome/88.0.4324.150 Safari/537.36",
35
37
  }
36
38
  r = requests.get(url, params=params, headers=headers)
37
39
  with warnings.catch_warnings(record=True):
@@ -40,7 +42,7 @@ def stock_margin_underlying_info_szse(date: str = "20221129") -> pd.DataFrame:
40
42
  return temp_df
41
43
 
42
44
 
43
- def stock_margin_szse(date: str = "20221129") -> pd.DataFrame:
45
+ def stock_margin_szse(date: str = "20240411") -> pd.DataFrame:
44
46
  """
45
47
  深圳证券交易所-融资融券数据-融资融券汇总
46
48
  https://www.szse.cn/disclosure/margin/margin/index.html
@@ -49,7 +51,7 @@ def stock_margin_szse(date: str = "20221129") -> pd.DataFrame:
49
51
  :return: 融资融券汇总
50
52
  :rtype: pandas.DataFrame
51
53
  """
52
- url = "http://www.szse.cn/api/report/ShowReport/data"
54
+ url = "https://www.szse.cn/api/report/ShowReport/data"
53
55
  params = {
54
56
  "SHOWTYPE": "JSON",
55
57
  "CATALOGID": "1837_xxpl",
@@ -58,8 +60,9 @@ def stock_margin_szse(date: str = "20221129") -> pd.DataFrame:
58
60
  "random": "0.7425245522795993",
59
61
  }
60
62
  headers = {
61
- "Referer": "http://www.szse.cn/disclosure/margin/object/index.html",
62
- "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.150 Safari/537.36",
63
+ "Referer": "https://www.szse.cn/disclosure/margin/object/index.html",
64
+ "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) "
65
+ "Chrome/88.0.4324.150 Safari/537.36",
63
66
  }
64
67
  r = requests.get(url, params=params, headers=headers)
65
68
  data_json = r.json()
@@ -73,17 +76,17 @@ def stock_margin_szse(date: str = "20221129") -> pd.DataFrame:
73
76
  "融资融券余额",
74
77
  ]
75
78
  temp_df["融资买入额"] = temp_df["融资买入额"].str.replace(",", "")
76
- temp_df["融资买入额"] = pd.to_numeric(temp_df["融资买入额"])
79
+ temp_df["融资买入额"] = pd.to_numeric(temp_df["融资买入额"], errors="coerce")
77
80
  temp_df["融资余额"] = temp_df["融资余额"].str.replace(",", "")
78
- temp_df["融资余额"] = pd.to_numeric(temp_df["融资余额"])
81
+ temp_df["融资余额"] = pd.to_numeric(temp_df["融资余额"], errors="coerce")
79
82
  temp_df["融券卖出量"] = temp_df["融券卖出量"].str.replace(",", "")
80
- temp_df["融券卖出量"] = pd.to_numeric(temp_df["融券卖出量"])
83
+ temp_df["融券卖出量"] = pd.to_numeric(temp_df["融券卖出量"], errors="coerce")
81
84
  temp_df["融券余量"] = temp_df["融券余量"].str.replace(",", "")
82
- temp_df["融券余量"] = pd.to_numeric(temp_df["融券余量"])
85
+ temp_df["融券余量"] = pd.to_numeric(temp_df["融券余量"], errors="coerce")
83
86
  temp_df["融券余额"] = temp_df["融券余额"].str.replace(",", "")
84
- temp_df["融券余额"] = pd.to_numeric(temp_df["融券余额"])
87
+ temp_df["融券余额"] = pd.to_numeric(temp_df["融券余额"], errors="coerce")
85
88
  temp_df["融资融券余额"] = temp_df["融资融券余额"].str.replace(",", "")
86
- temp_df["融资融券余额"] = pd.to_numeric(temp_df["融资融券余额"])
89
+ temp_df["融资融券余额"] = pd.to_numeric(temp_df["融资融券余额"], errors="coerce")
87
90
  return temp_df
88
91
 
89
92
 
@@ -96,7 +99,7 @@ def stock_margin_detail_szse(date: str = "20230925") -> pd.DataFrame:
96
99
  :return: 融资融券明细
97
100
  :rtype: pandas.DataFrame
98
101
  """
99
- url = "http://www.szse.cn/api/report/ShowReport"
102
+ url = "https://www.szse.cn/api/report/ShowReport"
100
103
  params = {
101
104
  "SHOWTYPE": "xlsx",
102
105
  "CATALOGID": "1837_xxpl",
@@ -106,8 +109,9 @@ def stock_margin_detail_szse(date: str = "20230925") -> pd.DataFrame:
106
109
  "TABKEY": "tab2",
107
110
  }
108
111
  headers = {
109
- "Referer": "http://www.szse.cn/disclosure/margin/margin/index.html",
110
- "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.150 Safari/537.36",
112
+ "Referer": "https://www.szse.cn/disclosure/margin/margin/index.html",
113
+ "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) "
114
+ "Chrome/88.0.4324.150 Safari/537.36",
111
115
  }
112
116
  r = requests.get(url, params=params, headers=headers)
113
117
  with warnings.catch_warnings(record=True):
@@ -145,8 +149,8 @@ if __name__ == "__main__":
145
149
  )
146
150
  print(stock_margin_underlying_info_szse_df)
147
151
 
148
- stock_margin_szse_df = stock_margin_szse(date="20210401")
152
+ stock_margin_szse_df = stock_margin_szse(date="20240411")
149
153
  print(stock_margin_szse_df)
150
154
 
151
- stock_margin_detail_szse_df = stock_margin_detail_szse(date="20210728")
155
+ stock_margin_detail_szse_df = stock_margin_detail_szse(date="20240411")
152
156
  print(stock_margin_detail_szse_df)
@@ -1,16 +1,19 @@
1
1
  #!/usr/bin/env python
2
2
  # -*- coding:utf-8 -*-
3
3
  """
4
- Date: 2023/12/2 18:00
4
+ Date: 2024/4/25 20:22
5
5
  Desc: 乐咕乐股网-赚钱效应分析
6
6
  https://www.legulegu.com/stockdata/market-activity
7
7
  """
8
+
8
9
  from io import StringIO
9
10
 
10
11
  import pandas as pd
11
12
  import requests
12
13
  from bs4 import BeautifulSoup
13
14
 
15
+ from akshare.utils.cons import headers
16
+
14
17
 
15
18
  def stock_market_activity_legu() -> pd.DataFrame:
16
19
  """
@@ -20,7 +23,7 @@ def stock_market_activity_legu() -> pd.DataFrame:
20
23
  :rtype: pandas.DataFrame
21
24
  """
22
25
  url = "https://legulegu.com/stockdata/market-activity"
23
- r = requests.get(url)
26
+ r = requests.get(url, headers=headers)
24
27
  temp_df = pd.read_html(StringIO(r.text))[0]
25
28
  temp_df_one = temp_df.iloc[:, :2]
26
29
  temp_df_one.columns = ["item", "value"]
@@ -28,17 +31,19 @@ def stock_market_activity_legu() -> pd.DataFrame:
28
31
  temp_df_two.columns = ["item", "value"]
29
32
  temp_df_three = temp_df.iloc[:, 4:6]
30
33
  temp_df_three.columns = ["item", "value"]
31
- temp_df = pd.concat([temp_df_one, temp_df_two, temp_df_three], ignore_index=True)
34
+ temp_df = pd.concat(
35
+ objs=[temp_df_one, temp_df_two, temp_df_three], ignore_index=True
36
+ )
32
37
  temp_df.dropna(how="all", axis=0, inplace=True)
33
- soup = BeautifulSoup(r.text, "lxml")
34
- item_str = soup.find("div", attrs={"class": "current-index"}).text
38
+ soup = BeautifulSoup(r.text, features="lxml")
39
+ item_str = soup.find(name="div", attrs={"class": "current-index"}).text
35
40
  inner_temp_df = pd.DataFrame([item.strip() for item in item_str.split(":")]).T
36
41
  inner_temp_df.columns = ["item", "value"]
37
- temp_df = pd.concat([temp_df, inner_temp_df], ignore_index=True)
38
- item_str = soup.find("div", attrs={"class": "current-data"}).text.strip()
42
+ temp_df = pd.concat(objs=[temp_df, inner_temp_df], ignore_index=True)
43
+ item_str = soup.find(name="div", attrs={"class": "current-data"}).text.strip()
39
44
  inner_temp_df = pd.DataFrame(["统计日期", item_str]).T
40
45
  inner_temp_df.columns = ["item", "value"]
41
- temp_df = pd.concat([temp_df, inner_temp_df], ignore_index=True)
46
+ temp_df = pd.concat(objs=[temp_df, inner_temp_df], ignore_index=True)
42
47
  temp_df.reset_index(inplace=True, drop=True)
43
48
  return temp_df
44
49