我在代码中使用以下脚本来抑制警告。但是,我在调用 sm.tsa.statespace.SARIMAX 模块时仍然收到警告。
warnings.simplefilter(action="ignore")
ValueWarning:未提供频率信息,因此将使用推断频率 MS。
我只是想摆脱警告。有没有办法强制执行?
答案 0 :(得分:0)
使用通行证
try :
#your code that made this issue
except:
pass
我也没有别的想法来摆脱它
答案 1 :(得分:0)
如果你只想忽略警告,试试这个:
import warnings
warnings.simplefilter(action='ignore', category=Warning)
但如果您想摆脱此警告的原因,查看 this 可能会有所帮助。
答案 2 :(得分:0)
# 禁止警告
from warnings import filterwarnings
filterwarnings('ignore')