커뮤니티
포인트
쿠폰
내 강의실
국비 신청 내역
증명서
계정
로그아웃
학습 질문
개발 일지
나의 활동
스스로 해결
2주차 숙제수행중 발생오류: KeyError: "None of [Index(['Cash'], dtype='object')] are in the [index]"
undefined주차
북마크
신*렬
댓글
2
추천
0
조회수
23
조회수
23
스스로 해결

* 겪고 있는 문제 상황을 최대한 자세하게 작성해주세요.

* 문제 해결을 위해 어떤 시도를 해보았는지 구체적으로 함께 알려주세요.


balancesheet에서 현금데이터를 가져오려는데 발생한 에러인데요.

"None of [Index(['Cash'], dtype='object')] are in the [index]"

해결방안이 뭔지요?


스파르타 즉문즉답




작성한 코드 및 에러 메세지

company = yf.Ticker('GOOG')

df = company.balancesheet.loc[['Cash']] ]] 
df



KeyError                                  Traceback (most recent call last)
<ipython-input-34-31f666fe757f> in <module>
      1 company = yf.Ticker('GOOG')
      2 
----> 3 df = company.balancesheet.loc[['Cash']]
      4 df


4 frames
/usr/local/lib/python3.8/dist-packages/pandas/core/indexing.py in _validate_read_indexer(self, key, indexer, axis)
   1372                 if use_interval_msg:
   1373                     key = list(key)
-> 1374                 raise KeyError(f"None of [{key}] are in the [{axis_name}]")
   1375 
   1376             not_found = list(ensure_index(key)[missing_mask.nonzero()[0]].unique())

KeyError: "None of [Index(['Cash'], dtype='object')] are in the [index]"
취소
 공유
취소
댓글 0
댓글 알림
나의얼굴