warnings 라이브러리

IT Newbie·2022년 6월 29일
0

Jupyter Notebook 이나 ipython 을 사용하다보면 향후 버전이 올라갈 때 변경될 사항 등을 알려주는 경고 메시지(warning message)가 거슬릴 때가 있습니다. 
이럴 때는 warnings 라이브러리를 사용한다.

  • warnings 라이브러리 import 하기
import warnings
  • 경고 메시지 무시하고 숨기기 (Ignore warning message)
warnings.filterwarnings(action='ignore')
  • 숨기기했던 경고 메시지 다시 보이기 (Reset to default)
warnings.filterwarnings(action='default')

출처: https://rfriend.tistory.com/346 [R, Python 분석과 프로그래밍의 친구 (by R Friend):티스토리]

0개의 댓글