Reputation: 67
I am trying to use the statsmodels.discrete.conditional_models.ConditionalLogit
class in statsmodel.
when importing the module in jupyter notebook, the conditional_models file is not found in discrete:
import statsmodels as sm
sm.__version__
dir(sm.discrete)
Results:
['PytestTester',
'__builtins__',
'__cached__',
'__doc__',
'__file__',
'__loader__',
'__name__',
'__package__',
'__path__',
'__spec__',
'count_model',
'discrete_margins',
'discrete_model',
'test']
sm.discrete.conditional_models.ConditionalLogit
Result:
AttributeError: module 'statsmodels.discrete' has no attribute 'conditional_models'
However, when I looked in the actual directory of statsmodels.discrete locally, I found the conditional_models.py file in the directory.
Installation : by pip version : '0.12.0.dev0+10.ge9ca9ca55'
Upvotes: 1
Views: 402
Reputation: 2854
Try importing it this way (see the statsmodels docs on their example for importing classes and functions):
from statsmodels.discrete.conditional_models import ConditionalLogit
Upvotes: 2
Reputation: 620
Last time I faced an error like this, it was because of my statsmodels version so it was resolved just by a simple uninstall/install.
pip uninstall statsmodels
pip install statsmodels
If you find the file it could installed but no properly so the action should do the trick.
Upvotes: 0