在Jupyter Notebook中禁用警告 [英] Disable warnings in jupyter notebook

查看:1313
本文介绍了在Jupyter Notebook中禁用警告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在jupyter笔记本中收到此警告.

I'm getting this warning in jupyter notebook.

/anaconda3/lib/python3.6/site-packages/ipykernel_launcher.py:10: DeprecationWarning: object of type <class 'float'> cannot be safely interpreted as an integer.
  # Remove the CWD from sys.path while we load stuff.
/anaconda3/lib/python3.6/site-packages/ipykernel_launcher.py:11: DeprecationWarning: object of type <class 'float'> cannot be safely interpreted as an integer.
  # This is added back by InteractiveShellApp.init_path()

这很烦人,因为它在我执行的每次运行中都会显示:

It's annoying because it shows up in every run I do:

如何修复或禁用它?

推荐答案

如果您确定自己的代码正确且简单,则想消除此警告以及笔记本中的所有其他警告,请执行以下:

If you are sure your code is correct and simple want to get rid of this warning and all other warnings in the notebook do the following:

import warnings
warnings.filterwarnings('ignore')

这篇关于在Jupyter Notebook中禁用警告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆