python - 在python中导入但未使用
问题描述
import bumpy as np
import matplotlib.pyplot as per
import pandas as pd.
控制台显示一些警告。谁能帮我这个
解决方案
In python, when you import a library, it is expected to be utilized in the code blocks. Hence, as it obviously states, you may have imported these but have not used all of them.
Besides that being the obvious warning, your imports should have been
import numpy as np
NOT bumpy
.
And remove the unnecessary period following the pandas import.
import pandas as pd
But if you still want to have imports and not use them, or keep them for later declarations, you could choose to suppress or ignore the warnings, which I do not endorse. But, if you so badly want to get rid of 'em, you can do so by adding the following line to the beginning of your code.
import warnings
warnings.filterwarnings("ignore")
推荐阅读
- typescript - 在 TypeScript 中,有没有办法创建一个泛型 mixin 函数,它还允许在返回的类上使用泛型类型参数?
- java - 基于对象类覆盖java中的打印语句
- javascript - 将一维二进制数组拆分为仅由连续一维组成的二维数组
- python - 使用蒙特卡罗方法评估多变量的多重积分
- flutter - 在这种情况下,在颤振中构建 .apk 文件有什么问题?
- matplotlib - 重置(或赋值)到 matplotlib 中的 RadioButton
- c# - 根据列表内容显示/隐藏 DataGrid 列
- java - 为特定 DBMS(数据库引擎)动态设置 DataSource 的正确方法是什么?
- html - 如何匹配 HTML 输入并使用 CSS 选择样式
- r - 将 data.frame 的列转换为命名向量