Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Data Science by (17.6k points)

Trying to use pyramid's auto arima function and getting nowhere.

Importing the whole class:

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

I get error message:

NameError: name 'auto_arima' is not defined

Fine, then let's import that specific package from pyramid.
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
After importing numpy, or even after just running the block again, I get this error message when running from 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

1 Answer

0 votes
by (41.4k points)

Firstly, create a new environment in Anaconda and then run:

pip install pyramid-arima

Now, you can use the below line of code in your python code:

from pyramid.arima import auto_arima

Gain practical exposure with data science projects in Intellipaat's Data Science course online.

Related questions

0 votes
1 answer
0 votes
1 answer
asked Oct 15, 2019 in Python by Sammy (47.6k points)
0 votes
2 answers
+3 votes
2 answers

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...