Whenever i am trying to import statsmodels.formula.api as smf i get the following error.
import statsmodels.formula.api as smf
Traceback (most recent call last):
File "<ipython-input-257-268d740a5877>", line 1, in <module>
import statsmodels.formula.api as smf
File "C:\Users\ldresl\Anaconda3\lib\site-
packages\statsmodels\formula\__init__.py", line 1, in <module>
from statsmodels import PytestTester
ImportError: cannot import name 'PytestTester'
You will have to update the package pytest and restart your kernel:
pip install pytest --upgrade
I had this problem importing statsmodels in a Jupyter notebook (Anaconda distribution). If you run on the same set-up, you can update a package in Anaconda like so:
conda update pytest
Do not forget to restart the kernel in the top navigation of your notebook afterwards. Hope that helps.
Worked for me,
pip install statsmodels --upgrade
pip install pytest --upgrade
Restart Kernel
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With