inflearn logo
강의

강의

N
챌린지

챌린지

멘토링

멘토링

N
클립

클립

로드맵

로드맵

지식공유

묻고 답해요

173만명의 커뮤니티!! 함께 토론해봐요.

A value is trying to be set on a copy of a slice from a DataFrame. 경고창 관련 질문

미해결

train['total_bedrooms'] = train['total_bedrooms'].fillna(train['total_bedrroms'].median()) train.loc[train['total_bedrooms'].isnull(),'total_bedrooms'] = train['total_bedrooms'].median() 빅데이터 분석기사 준비하던 도중 위 코드를 실행시키니 colab에서 경고창이 발생했습니다. <ipython-input-35-0cb00506e054>:17: SettingWithCopyWarning: A value is trying to be set on a copy of a slice from a DataFrame. Try using .loc[row_indexer,col_indexer] = value instead See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy train['total_bedrooms'] = train['total_bedrooms'].fillna(train['total_bedrooms'].median()) pandas 공식 홈페이지 설명문 (체인 인덱싱?)을 확인해봐도 이해가 정확히 되지 않는데, 어떠한 원리로 위에 코드가 경고창이 발생하는지 궁금합니다.

  • loc
  • iloc
  • chained_indexing
qhrbs98 댓글 1 좋아요 0 조회수 444

인기 태그

인프런 TOP Writers

주간 인기글