akshare 1.14.47__py3-none-any.whl → 1.14.48__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.

akshare/__init__.py CHANGED
@@ -2858,9 +2858,10 @@ amac_manager_cancelled_info # 中国证券投资基金业协会-信息公示-诚
2858
2858
  1.14.45 fix: fix option_lhb_em interface
2859
2859
  1.14.46 add: add spot_hog_soozhu interface
2860
2860
  1.14.47 fix: fix spot_hog_soozhu interface
2861
+ 1.14.48 add: add spot_hog_year_trend_soozhu interface
2861
2862
  """
2862
2863
 
2863
- __version__ = "1.14.47"
2864
+ __version__ = "1.14.48"
2864
2865
  __author__ = "AKFamily"
2865
2866
 
2866
2867
  import sys
@@ -2885,7 +2886,7 @@ del sys
2885
2886
  """
2886
2887
  搜猪-生猪大数据-各省均价实时排行榜
2887
2888
  """
2888
- from akshare.spot.spot_hog_soozhu import spot_hog_soozhu
2889
+ from akshare.spot.spot_hog_soozhu import spot_hog_soozhu, spot_hog_year_trend_soozhu
2889
2890
 
2890
2891
  """
2891
2892
  知名港股
@@ -3447,11 +3448,6 @@ from akshare.stock.stock_hk_hot_rank_em import (
3447
3448
  stock_hk_hot_rank_em,
3448
3449
  )
3449
3450
 
3450
- """
3451
- 冬奥会历届奖牌榜
3452
- """
3453
- from akshare.sport.sport_olympic_winter import sport_olympic_winter_hist
3454
-
3455
3451
  """
3456
3452
  财新指数
3457
3453
  """
@@ -38,6 +38,33 @@ def spot_hog_soozhu() -> pd.DataFrame:
38
38
  return big_df
39
39
 
40
40
 
41
+ def spot_hog_year_trend_soozhu() -> pd.DataFrame:
42
+ """
43
+ 搜猪-生猪大数据-今年以来全国出栏均价走势
44
+ https://www.soozhu.com/price/data/center/
45
+ :return: 今年以来全国出栏均价走势
46
+ :rtype: pd.DataFrame
47
+ """
48
+ session = requests.session()
49
+ url = "https://www.soozhu.com/price/data/center/"
50
+ r = session.get(url)
51
+ soup = BeautifulSoup(r.text, features="lxml")
52
+ token = soup.find(name="input", attrs={"name": "csrfmiddlewaretoken"})["value"]
53
+ url = "https://www.soozhu.com/price/data/center/"
54
+ payload = {"act": "yeartrend", "csrfmiddlewaretoken": token}
55
+ r = session.post(url, data=payload)
56
+ data_json = r.json()
57
+ temp_df = pd.DataFrame(data_json["nationlist"])
58
+ temp_df.columns = ["日期", "价格"]
59
+ temp_df["日期"] = pd.to_datetime(temp_df["日期"], errors="coerce").dt.date
60
+ temp_df["价格"] = pd.to_numeric(temp_df["价格"], errors="coerce")
61
+ temp_df.sort_values(by=["日期"], ignore_index=True, inplace=True)
62
+ return temp_df
63
+
64
+
41
65
  if __name__ == "__main__":
42
66
  spot_hog_soozhu_df = spot_hog_soozhu()
43
67
  print(spot_hog_soozhu_df)
68
+
69
+ spot_hog_year_trend_soozhu_df = spot_hog_year_trend_soozhu()
70
+ print(spot_hog_year_trend_soozhu_df)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: akshare
3
- Version: 1.14.47
3
+ Version: 1.14.48
4
4
  Summary: AKShare is an elegant and simple financial data interface library for Python, built for human beings!
5
5
  Home-page: https://github.com/akfamily/akshare
6
6
  Author: AKFamily
@@ -1,4 +1,4 @@
1
- akshare/__init__.py,sha256=VZTkZinnFxazlt-Pet9pEhTfVsS4bAuDnf6P9NiF4wA,180214
1
+ akshare/__init__.py,sha256=yjR0-ThxKTCa789trLHnOn7NP4tsPmdD148RWD04gJ8,180189
2
2
  akshare/datasets.py,sha256=oIu1zC7o_LMHY22lQmdM7vCnryHibKrJLBqJwQiitlI,1167
3
3
  akshare/air/__init__.py,sha256=RMTf1bT5EOE3ttWpn3hGu1LtUmsVxDoa0W7W0gXHOy8,81
4
4
  akshare/air/air_hebei.py,sha256=xIXNGLK7IGYqrkteM9fxnHAwWqk6PCQs6D9-ggZ7byY,4442
@@ -226,9 +226,8 @@ akshare/reits/__init__.py,sha256=0MO0aWWC8jQBth2IPl3W63vZKvuDb1OJqIpHE-sCQVU,82
226
226
  akshare/reits/reits_basic.py,sha256=gxQeP8_K7SYjBT9zkKuVRRi8B4SPOHNqVdXe_UvTWTY,2730
227
227
  akshare/sport/__init__.py,sha256=aMsxmuOMZFkcI8tGmQanhPyPwyBpdeApAWyCtDRKMeg,81
228
228
  akshare/sport/sport_olympic.py,sha256=CB1cvLpz2BWuadfonhHuQ17Qxt9X_3ks0Zc5Bff2w9k,818
229
- akshare/sport/sport_olympic_winter.py,sha256=l_NhDpYfUBJMCLDezIa8un1S5Z_R6giv8EsuTRXgt6E,1473
230
229
  akshare/spot/__init__.py,sha256=VGuha94pXYoezmMs3F3Q_ofaN8RZIrkJ2NtVv8hWCjY,83
231
- akshare/spot/spot_hog_soozhu.py,sha256=S42cfeR76cl2x9lKbQdIH9sawaqToXtIdJnr6kW5zZA,1508
230
+ akshare/spot/spot_hog_soozhu.py,sha256=4l040e30BIaqheivlQv-0H6AqR1zwvN5JKYYrZxfqlk,2641
232
231
  akshare/spot/spot_price_qh.py,sha256=rRv09vR8K0U_x6x8AiLgGluxytIXkLatFNVkFbIh8eQ,3756
233
232
  akshare/spot/spot_sge.py,sha256=Ta5EHUlGCSpNDlufIJcwgCErsJEUgH6HJHzYxoYtaMk,6313
234
233
  akshare/stock/__init__.py,sha256=jSa9260d6aNZajaW68chI2mpPkDSXLOgi3eXrqo4MQ8,82
@@ -381,8 +380,8 @@ akshare/utils/token_process.py,sha256=K4rGXjh_tgugbRcyOK2h2x0jP3PT65IIK7nxhUKhOe
381
380
  akshare/utils/tqdm.py,sha256=MuPNwcswkOGjwWQOMWXi9ZvQ_RmW4obCWRj2i7HM7FE,847
382
381
  tests/__init__.py,sha256=gNzhlO0UPjFq6Ieb38kaVIODXv4cTDByrdohAZnDYt4,82
383
382
  tests/test_func.py,sha256=tfvy_YnYmDra2dkKZ5JvprU1gNW5X9T634PszdSdH1A,944
384
- akshare-1.14.47.dist-info/LICENSE,sha256=mmSZCPgfHiVw34LXuFArd-SUgQtBJ_QsIlh-kWlDHfs,1073
385
- akshare-1.14.47.dist-info/METADATA,sha256=pbqC023BkL1kqUqJZZkVrGsZfpo4CXuw-xGh__HGc1U,13976
386
- akshare-1.14.47.dist-info/WHEEL,sha256=R0nc6qTxuoLk7ShA2_Y-UWkN8ZdfDBG2B6Eqpz2WXbs,91
387
- akshare-1.14.47.dist-info/top_level.txt,sha256=jsf9ZzZPmHaISTVumQPsAw7vv7Yv-PdEVW70SMEelQQ,14
388
- akshare-1.14.47.dist-info/RECORD,,
383
+ akshare-1.14.48.dist-info/LICENSE,sha256=mmSZCPgfHiVw34LXuFArd-SUgQtBJ_QsIlh-kWlDHfs,1073
384
+ akshare-1.14.48.dist-info/METADATA,sha256=mcHKs8J_xq_2PYI_OO9VfH4mnvAE4L7zTclwQF7ddoE,13976
385
+ akshare-1.14.48.dist-info/WHEEL,sha256=R0nc6qTxuoLk7ShA2_Y-UWkN8ZdfDBG2B6Eqpz2WXbs,91
386
+ akshare-1.14.48.dist-info/top_level.txt,sha256=jsf9ZzZPmHaISTVumQPsAw7vv7Yv-PdEVW70SMEelQQ,14
387
+ akshare-1.14.48.dist-info/RECORD,,
@@ -1,39 +0,0 @@
1
- #!/usr/bin/env python
2
- # -*- coding:utf-8 -*-
3
- """
4
- Date: 2022/2/8 17:14
5
- Desc: 腾讯运动-冬奥会-历届奖牌榜
6
- https://m.sports.qq.com/g/sv3/winter-oly22/winter-olympic-rank.htm?type=0
7
- """
8
- import requests
9
- import pandas as pd
10
-
11
-
12
- def sport_olympic_winter_hist() -> pd.DataFrame:
13
- """
14
- 腾讯运动-冬奥会-历届奖牌榜
15
- :return: 历届奖牌榜
16
- :rtype: pandas.DataFrame
17
- """
18
- url = "https://app.sports.qq.com/m/oly/historyMedal"
19
- r = requests.get(url)
20
- data_json = r.json()
21
- temp_df = pd.DataFrame(data_json["data"]["list"])
22
- temp_df = temp_df.explode("list")
23
- temp_df["国家及地区"] = temp_df["list"].apply(lambda x: (x["noc"]))
24
- temp_df["金牌数"] = temp_df["list"].apply(lambda x: (int(x["gold"])))
25
- temp_df["总奖牌数"] = temp_df["list"].apply(lambda x: (int(x["total"])))
26
- temp_df["举办年份"] = temp_df["year"].astype("str")
27
- temp_df["届数"] = temp_df["no"].astype("str")
28
- temp_df["举办地点"] = temp_df["country"]
29
- temp_df = temp_df[["举办年份", "届数", "举办地点", "国家及地区", "金牌数", "总奖牌数"]]
30
- temp_df = temp_df.replace("俄罗斯奥委会", "俄罗斯")
31
- temp_df.reset_index(inplace=True)
32
- temp_df["index"] = range(1, len(temp_df) + 1)
33
- temp_df.rename(columns={"index": "序号"}, inplace=True)
34
- return temp_df
35
-
36
-
37
- if __name__ == "__main__":
38
- sport_olympic_winter_hist_df = sport_olympic_winter_hist()
39
- print(sport_olympic_winter_hist_df)