[英]Python 3.9 in Statsmodel ImportError: cannot import name 'Literal' from 'statsmodels.compat.python'
I cannot manage to import ARIMA model from statsmodels without encountering this error:如果没有遇到此错误,我无法设法从 statsmodels 导入 ARIMA 模型:
This is how the import is:导入是这样的:
from statsmodels.tsa.arima.model import ARIMA
This is the error:这是错误:
ImportError: cannot import name 'Literal' from 'statsmodels.compat.python' (C:\Users\HP\Anaconda3\lib\site-packages\statsmodels\compat\python.py)
I have already tried to uninstall, re-install and update it, but that does not change.我已经尝试卸载、重新安装和更新它,但这并没有改变。 Please help me solve the error.请帮我解决错误。
I found the solution:我找到了解决方案:
Importing ARIMA from arima_model
instead of arima.model
:从arima_model
而不是arima.model
导入 ARIMA:
from statsmodels.tsa.arima_model import ARIMA
https://www.statsmodels.org/0.8.0/generated/statsmodels.tsa.arima_model.ARIMA.html https://www.statsmodels.org/0.8.0/generated/statsmodels.tsa.arima_model.ARIMA.html
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.