python - Python Pandas – 如何抑制 PerformanceWarning?
问题描述
如何抑制熊猫中的 PerformanceWarning?
我已经尝试过了warnings.simplefilter(action='ignore', category=PerformanceWarning)
,但它给了我一个NameError: name 'PerformanceWarning' is not defined
解决方案
PerformanceWarning 不是内置警告类,因此您不能直接在类别参数中调用它。您可以尝试以下代码:
import pandas as pd
import warnings
warnings.simplefilter(action='ignore', category=pd.errors.PerformanceWarning)
我不知道如何重现 PerformanceWarning 但我测试了与“ SettingWithCopyWarning ”熊猫警告类似的方法并且它有效。让我知道它是否有效。
推荐阅读
- android - PendingIntent from Notifications are not coming back to service. Showing java.lang.NullPointerException
- node.js - 基于其他模型自动更新 MongoDB 模型
- find - 移动文件和复制子树
- wordpress - WC 费用 API 后计算运费
- assembly - 一个简单的 hello world shellcode 中的分段错误?
- c# - 如何使用用户输入名称创建文件?
- r - Check if columns of one data frame are present in another data frame with non-zero element in R
- javascript - 将 DIV 子项更改为无显示
- amazon-web-services - 基于标签的 AWS IAM 政策限制未授予我任何访问权限
- html - 如何在 HTML 中的列表下添加空格