python – 从金字塔导入auto_arima时出错
作者:互联网
试图使用金字塔的自动arima功能,无处可去.
导入全班:
import pyramid
stepwise_fit = auto_arima(df.Weighted_Price, start_p=0, start_q=0, max_p=10, max_q=10, m=1,
start_P=0, seasonal=True, trace=True,
error_action='ignore', # don't want to know if an order does not work
suppress_warnings=True, # don't want convergence warnings
stepwise=True) # set to stepwise
我收到错误消息:
NameError: name 'auto_arima' is not defined
好的,然后让我们从金字塔中导入特定的包.
from pyramid.arima import auto_arima
————————————————————————— RuntimeError Traceback (most recent call
last) RuntimeError: module compiled against API version 0xb but this
version of numpy is 0xa————————————————————————— ImportError Traceback (most recent call
last) in ()
1 #trying to import pyramid
—-> 2 from pyramid.arima import auto_arima/usr/local/lib/python2.7/site-packages/pyramid/arima/init.py in
()
3 # Author: Taylor Smith
4
—-> 5 from .approx import *
6 from .arima import *
7 from .auto import */usr/local/lib/python2.7/site-packages/pyramid/arima/approx.py in
()
16 # and since the platform might name the .so file something funky (like
17 # _arima.cpython-35m-darwin.so), import this absolutely and not relatively.
—> 18 from pyramid.arima._arima import C_Approx
19
20 all = [ImportError: numpy.core.multiarray failed to import
导入numpy之后,或者甚至在刚刚再次运行块之后,从pyramid.arima import auto_arima运行时出现此错误消息
————————————————————————— ImportError Traceback (most recent call
last) in ()
1 #trying to import pyramid
—-> 2 from pyramid import arima/usr/local/lib/python2.7/site-packages/pyramid/arima/init.py in
()
3 # Author: Taylor Smith
4
—-> 5 from .approx import *
6 from .arima import *
7 from .auto import */usr/local/lib/python2.7/site-packages/pyramid/arima/approx.py in
()
16 # and since the platform might name the .so file something funky (like
17 # _arima.cpython-35m-darwin.so), import this absolutely and not relatively.
—> 18 from pyramid.arima._arima import C_Approx
19
20 all = [ImportError: cannot import name C_Approx
解决方法:
环境:
Windows 10
IDE:Pycharm
Python:3.6
在Anaconda中,创建一个新环境,然后运行:
pip install pyramid-arima
现在在你的python代码中,你可以使用:
来自pyramid.arima import auto_arima
标签:python,data-science,pyramid-analytics 来源: https://codeday.me/bug/20190622/1263638.html