작성
·
1.1K
답변 3
1
0
finance-datareader==0.9.20
pandas==1.2.4
으로 했는데도 여전히 작동하지 않습니다.
근데 오류가 바뀌었네요.; 아래와 같습니다.
import FinanceDataReader as fdr
df = fdr.DataReader("005930", '2018-01-02', '2018-12-31')
df = df[['Close']]
df.columns = ["삼성전자"]
print(df.shape)
df.head(10)
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-13-822acea6143f> in <module>
----> 1 import FinanceDataReader as fdr
2
3 df = fdr.DataReader("005930", '2018-01-02', '2018-12-31')
4 df = df[['Close']]
5 df.columns = ["삼성전자"]
~\anaconda3\lib\site-packages\FinanceDataReader\__init__.py in <module>
----> 1 from .data import (DataReader)
2 from .data import (StockListing)
3 from .data import (EtfListing)
4 from . import (chart)
5
~\anaconda3\lib\site-packages\FinanceDataReader\data.py in <module>
----> 1 from FinanceDataReader.investing.data import (InvestingDailyReader)
2 from FinanceDataReader.fred.data import (FredReader)
3 from FinanceDataReader.krx.data import (KrxDelistingReader)
4 from FinanceDataReader.naver.data import (NaverDailyReader)
5 from FinanceDataReader.nasdaq.listing import (NasdaqStockListing)
~\anaconda3\lib\site-packages\FinanceDataReader\investing\data.py in <module>
2 import json
3 import requests
----> 4 import pandas as pd
5 from FinanceDataReader._utils import (_convert_letter_to_num, _validate_dates)
6
~\AppData\Roaming\Python\Python38\site-packages\pandas\__init__.py in <module>
49 import pandas.core.config_init
50
---> 51 from pandas.core.api import (
52 # dtype
53 Int8Dtype,
~\anaconda3\lib\site-packages\pandas\core\api.py in <module>
22 )
23
---> 24 from pandas.core.algorithms import (
25 factorize,
26 unique,
~\anaconda3\lib\site-packages\pandas\core\algorithms.py in <module>
32 from pandas.util._decorators import doc
33
---> 34 from pandas.core.dtypes.cast import (
35 construct_1d_object_array_from_listlike,
36 infer_dtype_from_array,
ImportError: cannot import name 'sanitize_to_nanoseconds' from 'pandas.core.dtypes.cast' (C:\Users\USER\anaconda3\lib\site-packages\pandas\core\dtypes\cast.py)
0
그리고 df1 = fdr.DataReader("005930", '2018-01-02', '2018-10-30')
를 작성한 jupyter cell 과 해당 코드의 output(error)내용 스샷 부탁드립니다,
혹시 수업자료로 제공한 requirements.txt 버전과 다른 버전을 사용하시는 이유가 있으신가요? pip install -r requirements.txt
를 먼저 진행하시고 재실행 후 결과 확인부탁드립니다.
finance-datareader=0.9.66 pandas=2.1.4 에서 문제가 해결되었습니다.