我已经回答了这个问题 While importing auto_arima from pmdarima: ERROR : cannot import name 'factorial' from 'scipy.misc' 但无法解决该错误,我不知道如何使用开发人员版本。 还有其他应用季节性ARIMA模型的方法吗?
import statsmodels.api as sm
mod = sm.tsa.statespace.SARIMAX(train_weekly.Price,
order=(1, 0, 0),
seasonal_order=(1, 1, 0, 12),
enforce_stationarity=False,
enforce_invertibility=False)
results = mod.fit()
print(results.summary().tables[0])
print(results.summary().tables[1])
以下是输出
ImportError Traceback (most recent call last)
<ipython-input-30-a5d9120bdc57> in <module>()
----> 1 import statsmodels.api as sm
2 mod = sm.tsa.statespace.SARIMAX(train_weekly.Price,
3 order=(1, 0, 0),
4 seasonal_order=(1, 1, 0, 12),
5 enforce_stationarity=False,
3 frames
/usr/local/lib/python3.6/dist-packages/statsmodels/api.py in <module>()
14 from . import robust
15 from .robust.robust_linear_model import RLM
---> 16 from .discrete.discrete_model import (Poisson, Logit, Probit,
17 MNLogit, NegativeBinomial,
18 GeneralizedPoisson,
/usr/local/lib/python3.6/dist-packages/statsmodels/discrete/discrete_model.py in <module>()
43
44 from statsmodels.base.l1_slsqp import fit_l1_slsqp
---> 45 from statsmodels.distributions import genpoisson_p
46
47 try:
/usr/local/lib/python3.6/dist-packages/statsmodels/distributions/__init__.py in <module>()
1 from .empirical_distribution import ECDF, monotone_fn_inverter, StepFunction
----> 2 from .edgeworth import ExpandedNormal
3 from .discrete import genpoisson_p, zipoisson, zigenpoisson, zinegbin
/usr/local/lib/python3.6/dist-packages/statsmodels/distributions/edgeworth.py in <module>()
5 import numpy as np
6 from numpy.polynomial.hermite_e import HermiteE
----> 7 from scipy.misc import factorial
8 from scipy.stats import rv_continuous
9 import scipy.special as special
ImportError: cannot import name 'factorial'
我只想使用季节性ARIMA,如果还有其他方法,请帮助我。 谢谢。
答案 0 :(得分:1)
似乎scipy模块的版本不匹配。尝试降级scipy模块。
在Windows中,以管理模式执行以下命令,
pip3 install --user scipy==1.2.0
如果您使用的是Linux,
python3.6 -m pip install scipy==1.2 --upgrade