문
import pandas_datareader as pdr
df = pdr.get_data_yahoo('005930.KS', '2022-01-01', '2022-09-30')
print('row count:', len(df))
df.tail(10)
실행 시 에러
TypeError Traceback (most recent call last)
<ipython-input-11-6158f7314c87> in <cell line: 3>()
1 import pandas_datareader as pdr
2
----> 3 df = pdr.get_data_yahoo('005930.KS', '2022-01-01', '2022-09-30')
4
5 print('row count:', len(df))
2 frames
/usr/local/lib/python3.10/dist-packages/pandas_datareader/yahoo/daily.py in _read_one_data(self, url, params)
151 try:
152 j = json.loads(re.search(ptrn, resp.text, re.DOTALL).group(1))
--> 153 data = j["context"]["dispatcher"]["stores"]["HistoricalPriceStore"]
154 except KeyError:
155 msg = "No data fetched for symbol {} using {}"
TypeError: string indices must be integers
시
검색
https://github.com/pydata/pandas-datareader/issues/868
해
import pandas
from pandas_datareader import data as pdr
import yfinance as yfin
yfin.pdr_override()
df = pdr.get_data_yahoo("005930.KS", start="2022-01-01", end="2022-09-30")
print('row count:', len(df))
df.tail(10)
'TIL' 카테고리의 다른 글
TIL 051723 (0) | 2023.05.16 |
---|---|
TIL 051623 (0) | 2023.05.16 |
TIL 051223 (0) | 2023.05.12 |
TIL 051123 (0) | 2023.05.11 |
TIL 051023 (0) | 2023.05.10 |