Closed mr-yoo closed 4 years ago
위와 같은 데이터 프레임에서 다음 코드를 실행하니 에러가 출력 됨
cond = self.df.index == '코스피'
self.df.loc[cond, 'ind_tp_cd'][0]
Series 객체에 대해 [0]
직접 인덱싱하는 부분에서 에러 발생 함.
iloc[0]
로 변경하니 정상 동작함
df.loc[cond, 'ind_tp_cd']
자체가 하나의 값을 반환해야 하는데, 중복된 값들이 저장된 결과를 서버가 반환 함. (요청이 잘못 됐을 수 있음). root cause를 제거하는게 좋아 보임.
Index 및 Ticker 코드를 정리하는게 좋아 보임. 다음 이슈도 관련돼 있음. https://github.com/sharebook-kr/pykrx/issues/3
다음 이슈에서 버그 수정 및 refactoring 함
import pykrx
print(pykrx.__version__)
0.1.37
from pykrx import stock
df = stock.get_index_ohlcv_by_date("20200101", "20200831", "코스피")
df.head()
Pycharm에서는 정상동작하지만 JupyterNoteBook에서 에러 메시지 출력
Python 3.7.6