akshare 1.14.83__py3-none-any.whl → 1.14.84__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 +2 -1
- akshare/index/index_drewry.py +17 -16
- {akshare-1.14.83.dist-info → akshare-1.14.84.dist-info}/METADATA +1 -1
- {akshare-1.14.83.dist-info → akshare-1.14.84.dist-info}/RECORD +7 -7
- {akshare-1.14.83.dist-info → akshare-1.14.84.dist-info}/LICENSE +0 -0
- {akshare-1.14.83.dist-info → akshare-1.14.84.dist-info}/WHEEL +0 -0
- {akshare-1.14.83.dist-info → akshare-1.14.84.dist-info}/top_level.txt +0 -0
akshare/__init__.py
CHANGED
|
@@ -2894,9 +2894,10 @@ amac_manager_cancelled_info # 中国证券投资基金业协会-信息公示-诚
|
|
|
2894
2894
|
1.14.81 fix: fix stock_hsgt_hist_em interface
|
|
2895
2895
|
1.14.82 fix: fix stock_comment_detail_scrd_desire_daily_em interface
|
|
2896
2896
|
1.14.83 fix: fix stock_comment_detail_zhpj_lspf_em interface
|
|
2897
|
+
1.14.84 fix: fix drewry_wci_index interface
|
|
2897
2898
|
"""
|
|
2898
2899
|
|
|
2899
|
-
__version__ = "1.14.
|
|
2900
|
+
__version__ = "1.14.84"
|
|
2900
2901
|
__author__ = "AKFamily"
|
|
2901
2902
|
|
|
2902
2903
|
import sys
|
akshare/index/index_drewry.py
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
#!/usr/bin/env python
|
|
2
2
|
# -*- coding:utf-8 -*-
|
|
3
3
|
"""
|
|
4
|
-
Date:
|
|
4
|
+
Date: 2024/9/26 18:00
|
|
5
5
|
Desc: Drewry 集装箱指数
|
|
6
6
|
https://www.drewry.co.uk/supply-chain-advisors/supply-chain-expertise/world-container-index-assessed-by-drewry
|
|
7
7
|
https://infogram.com/world-container-index-1h17493095xl4zj
|
|
8
8
|
"""
|
|
9
|
+
|
|
9
10
|
import pandas as pd
|
|
10
11
|
import requests
|
|
11
12
|
from bs4 import BeautifulSoup
|
|
@@ -17,7 +18,8 @@ def drewry_wci_index(symbol: str = "composite") -> pd.DataFrame:
|
|
|
17
18
|
"""
|
|
18
19
|
Drewry 集装箱指数
|
|
19
20
|
https://infogram.com/world-container-index-1h17493095xl4zj
|
|
20
|
-
:param symbol: choice of {"composite", "shanghai-rotterdam", "rotterdam-shanghai", "shanghai-los angeles",
|
|
21
|
+
:param symbol: choice of {"composite", "shanghai-rotterdam", "rotterdam-shanghai", "shanghai-los angeles",
|
|
22
|
+
"los angeles-shanghai", "shanghai-genoa", "new york-rotterdam", "rotterdam-new york"}
|
|
21
23
|
:type symbol: str
|
|
22
24
|
:return: Drewry 集装箱指数
|
|
23
25
|
:rtype: pandas.DataFrame
|
|
@@ -34,24 +36,23 @@ def drewry_wci_index(symbol: str = "composite") -> pd.DataFrame:
|
|
|
34
36
|
}
|
|
35
37
|
url = "https://infogram.com/world-container-index-1h17493095xl4zj"
|
|
36
38
|
r = requests.get(url)
|
|
37
|
-
soup = BeautifulSoup(r.text, "lxml")
|
|
39
|
+
soup = BeautifulSoup(r.text, features="lxml")
|
|
38
40
|
data_text = soup.find_all("script")[-4].string.strip("window.infographicData=")[:-1]
|
|
39
41
|
data_json = demjson.decode(data_text)
|
|
40
|
-
|
|
41
|
-
|
|
42
|
+
data_json_need = data_json["elements"]["content"]["content"]["entities"][
|
|
43
|
+
"7a55585f-3fb3-44e6-9b54-beea1cd20b4d"
|
|
44
|
+
]["data"][symbol_map[symbol]]
|
|
45
|
+
date_list = [item[0]["value"] for item in data_json_need[1:]]
|
|
46
|
+
try:
|
|
47
|
+
value_list = [item[1]["value"] for item in data_json_need[1:]]
|
|
48
|
+
except TypeError:
|
|
49
|
+
value_list = [item[1]["value"] for item in data_json_need[1:-1]]
|
|
50
|
+
temp_df = pd.DataFrame([date_list, value_list]).T
|
|
42
51
|
temp_df.columns = ["date", "wci"]
|
|
43
|
-
temp_df["date"] =
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
month = temp_df["date"].str.split("-", expand=True).iloc[:, 1].str.strip()
|
|
47
|
-
month = month.str.replace("July", "Jul")
|
|
48
|
-
year = temp_df["date"].str.split("-", expand=True).iloc[:, 2].str.strip()
|
|
49
|
-
temp_df["date"] = day + "-" + month + "-" + year
|
|
50
|
-
# 修正数据源中日期格式的错误
|
|
51
|
-
temp_df["date"] = temp_df["date"].str.replace("Sept", "Sep")
|
|
52
|
-
temp_df["date"] = pd.to_datetime(temp_df["date"], format="%d-%b-%y").dt.date
|
|
52
|
+
temp_df["date"] = pd.to_datetime(
|
|
53
|
+
temp_df["date"], format="%d-%b-%y", errors="coerce"
|
|
54
|
+
).dt.date
|
|
53
55
|
temp_df["wci"] = pd.to_numeric(temp_df["wci"], errors="coerce")
|
|
54
|
-
temp_df.reset_index(inplace=True, drop=True)
|
|
55
56
|
return temp_df
|
|
56
57
|
|
|
57
58
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
akshare/__init__.py,sha256=
|
|
1
|
+
akshare/__init__.py,sha256=siaAbZ64GnNdzkScy_hOfwhcG3zhBZGLWEgWtD90PLA,182024
|
|
2
2
|
akshare/datasets.py,sha256=-qdwaQjgBlftX84uM74KJqCYJYkQ50PV416_neA4uls,995
|
|
3
3
|
akshare/air/__init__.py,sha256=RMTf1bT5EOE3ttWpn3hGu1LtUmsVxDoa0W7W0gXHOy8,81
|
|
4
4
|
akshare/air/air_hebei.py,sha256=xIXNGLK7IGYqrkteM9fxnHAwWqk6PCQs6D9-ggZ7byY,4442
|
|
@@ -158,7 +158,7 @@ akshare/index/index_cflp.py,sha256=iPn_0kePK74eScwC7rj0IhC-3w-kGQWtWlwsW-J0nbs,4
|
|
|
158
158
|
akshare/index/index_cni.py,sha256=qravLXiETWlegIMV_EIUTDbGQfdC2zsj4LykWzC8Lko,8563
|
|
159
159
|
akshare/index/index_cons.py,sha256=3jrDfdxhNr9c4NVsTVOyORZwKBFNUU8giERYoIKkUUY,7682
|
|
160
160
|
akshare/index/index_cx.py,sha256=aAmsIKkswKFNOhAsW0QOhp-q6q1aFOSBtqcDaZhIh6A,16775
|
|
161
|
-
akshare/index/index_drewry.py,sha256=
|
|
161
|
+
akshare/index/index_drewry.py,sha256=BM7V6P8K4QUFQArsdaWRu5qJUZaCoyNz97_b8dmLeCw,2937
|
|
162
162
|
akshare/index/index_eri.py,sha256=7X0KNDBntEkE_qSb2jb6IBv-S8PsevLFdxGT8nKT3W0,2111
|
|
163
163
|
akshare/index/index_fear_greed_funddb.py,sha256=7Z6GqYkKPJHNHMEN-uZNu2KnNNLTWvJcVlYpfAShJJc,2378
|
|
164
164
|
akshare/index/index_hog.py,sha256=kb867BVagt70_ycZMn22ks5Z9jlVbMiuTsvq5ygjeig,1657
|
|
@@ -380,8 +380,8 @@ akshare/utils/token_process.py,sha256=K4rGXjh_tgugbRcyOK2h2x0jP3PT65IIK7nxhUKhOe
|
|
|
380
380
|
akshare/utils/tqdm.py,sha256=MuPNwcswkOGjwWQOMWXi9ZvQ_RmW4obCWRj2i7HM7FE,847
|
|
381
381
|
tests/__init__.py,sha256=gNzhlO0UPjFq6Ieb38kaVIODXv4cTDByrdohAZnDYt4,82
|
|
382
382
|
tests/test_func.py,sha256=j1MGYbZI2if2j_LY1S4FLsf4qfq4NwVqD5wmRlv5Log,832
|
|
383
|
-
akshare-1.14.
|
|
384
|
-
akshare-1.14.
|
|
385
|
-
akshare-1.14.
|
|
386
|
-
akshare-1.14.
|
|
387
|
-
akshare-1.14.
|
|
383
|
+
akshare-1.14.84.dist-info/LICENSE,sha256=mmSZCPgfHiVw34LXuFArd-SUgQtBJ_QsIlh-kWlDHfs,1073
|
|
384
|
+
akshare-1.14.84.dist-info/METADATA,sha256=dQ1bPRyg9ju6jfQG2hSJhIVA-I7jQLjs20dPBY1Jm0s,14112
|
|
385
|
+
akshare-1.14.84.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
|
|
386
|
+
akshare-1.14.84.dist-info/top_level.txt,sha256=jsf9ZzZPmHaISTVumQPsAw7vv7Yv-PdEVW70SMEelQQ,14
|
|
387
|
+
akshare-1.14.84.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|