Skip to content

Commit

Permalink
fix: fix stock_a_ttm_lyr
Browse files Browse the repository at this point in the history
  • Loading branch information
albertandking committed Oct 18, 2024
1 parent e245b9e commit d1cc50f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 13 deletions.
9 changes: 3 additions & 6 deletions akshare/stock_feature/stock_ttm_lyr.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Desc: 全部A股-等权重市盈率、中位数市盈率
https://www.legulegu.com/stockdata/a-ttm-lyr
"""

import pandas as pd
import requests

Expand All @@ -26,15 +27,11 @@ def stock_a_ttm_lyr() -> pd.DataFrame:
r = requests.get(
url,
params=params,
**get_cookie_csrf(url="https://www.legulegu.com/stockdata/a-ttm-lyr")
**get_cookie_csrf(url="https://www.legulegu.com/stockdata/a-ttm-lyr"),
)
data_json = r.json()
temp_df = pd.DataFrame(data_json["data"])
temp_df["date"] = (
pd.to_datetime(temp_df["date"], unit="ms", utc=True)
.dt.tz_convert("Asia/Shanghai")
.dt.date
)
temp_df["date"] = pd.to_datetime(temp_df["date"], errors="coerce").dt.date
return temp_df


Expand Down
14 changes: 7 additions & 7 deletions docs/data/stock/stock.md
Original file line number Diff line number Diff line change
Expand Up @@ -15828,13 +15828,13 @@ print(stock_a_ttm_lyr_df)
2 2005-01-07 28.73 ... 0.66667 0.00
3 2005-01-10 28.84 ... 0.50000 0.00
4 2005-01-11 29.09 ... 1.00000 0.00
... ... ... ... ...
4680 2024-04-18 28.30 ... 0.03376 3569.80
4681 2024-04-21 28.15 ... 0.03746 3541.66
4682 2024-04-22 28.06 ... 0.03705 3530.90
4683 2024-04-23 28.33 ... 0.04858 3506.22
4684 2024-04-24 28.84 ... 0.06587 3521.62
[4685 rows x 14 columns]
... ... ... ... ... ...
4795 2024-10-13 29.58 ... 0.15534 3887.17
4796 2024-10-14 30.34 ... 0.20725 3961.34
4797 2024-10-15 29.75 ... 0.18995 3855.99
4798 2024-10-16 29.67 ... 0.20643 3831.59
4799 2024-10-17 29.56 ... 0.20107 3788.22
[4800 rows x 14 columns]
```

#### A 股等权重与中位数市净率
Expand Down

0 comments on commit d1cc50f

Please sign in to comment.