Vai*_*aro 2 python suppress-warnings pandas
如何限制熊猫的PerformanceWarning?
我已经尝试过了warnings.simplefilter(action='ignore', category=PerformanceWarning)
,但是它给了我一个NameError: name 'PerformanceWarning' is not defined
小智 5
PerformanceWarning不是内置的警告类,因此您不能在category参数中直接调用它。您可以尝试以下代码:
import pandas as pd
warnings.simplefilter(action='ignore', category=pd.errors.PerformanceWarning)
Run Code Online (Sandbox Code Playgroud)
我不知道如何重现PerformanceWarning,但我测试了一种与“ SettingWithCopyWarning ”熊猫警告类似的方法,并且该方法有效。让我知道它是否有效。
归档时间: |
|
查看次数: |
690 次 |
最近记录: |