nwly
nwly

Reputation: 1511

statsmodels missing .api, .regression, etc

I am trying to call statsmodels.api and statsmodels.regression in python 3.5 in a jupyter notebook. This is inside a virtual env. Using OSX El Capitan. I get the error

AttributeError: module 'statsmodels' has no attribute 'regression'

and similarly for calling statsmodels.api:

AttributeError: module 'statsmodels' has no attribute 'api'

Tried uninstalling and reinstalling via pip to no avail. Checked the statsmodels folder in site-packages, and it seems complete. This is for the latest version statsmodels 0.8.0. I also tried it for a separate python 2.7 venv, and am running into the same issue. Any clues as to what's going on?

Upvotes: 1

Views: 2212

Answers (1)

nwly
nwly

Reputation: 1511

Turns out to be an import mistake. According to statsmodels doc, the recommended import is import statsmodels.api as sm. I was using the import line import statsmodels as sm, which couldn't directly access the .api module.

Upvotes: 4

Related Questions