Python

[Jupyter Notebook] FutureWarning: Passing a set as an indexer is deprecated and will raise in a future version. Use a list instead. new_df = df[{'name', 'current_price'}]

xojuholic 2022. 11. 24.
728x90
반응형

Pandas 모듈을 import pandas as pd 선언으로 불러온 후 앞선 작업으로 생성했던 DataFrame에서 new_df = df[{'name', 'current_price'}] 입력하고 확인하기 위해 new_df 입력 후 Crtl + Enter 실행하니 제목과 같은 Warning 메시지가 나타났다.

FutureWarning: Passing a set as an indexer is deprecated and will raise in a future version. Use a list instead.  new_df = df[{'name', 'current_price'}]

 

메시지를 보니 df[{'name', 'current_price'}] Syntax는 더 이상 유지보수 되지 않는다는 (deprecated) 의미로 판단되어 아래와 같이 수정하니 저 Warning 메시지가 뜨지 않음을 확인했다.

  • 수정 : df[{'name', 'current_price'}]
  • 수정 : df[['name', 'current_price']]

 

728x90
반응형
SMALL

댓글

💲 추천 글