Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ImportError: No module named statsmodels.api

I'm new in python and have this problem. I have install Pandas, Numpy, Scipy, and I install Stats Models with apt-get install python-statsmodels, but when I try to use:

import statsmodels.api as sm

But I have this problem:

ImportError                               Traceback (most recent call last)
<ipython-input-1-6030a6549dc0> in <module>()
----> 1 import statsmodels.api as sm

ImportError: No module named statsmodels.api

Why??

like image 324
F.N.B Avatar asked Nov 02 '22 19:11

F.N.B


2 Answers

On Ubuntu 12.04, statsmodels is installed through scikits.

Hence:

import scikits.statsmodels.api as sm
like image 111
user2422635 Avatar answered Nov 14 '22 22:11

user2422635


from statsmodels import api as sm
like image 26
RickyA Avatar answered Nov 14 '22 20:11

RickyA