Search code examples
pythonimportjupyter-notebookimporterrorstatsmodels

Unable to import statsmodels on jupyter notebook


I've installed statsmodels and it says "requirement already satisfied", but when I import it I get an error that the module doesn't exist.

conda update -n base -c defaults conda
pip install statsmodels
import statsmodel.api as sm
import yfinance as yf
import matplotlib.pyplot as plt
import datetime as dt
ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-9-07cc0a2ad076> in <module>
      2 import matplotlib.pyplot as plt
      3 import datetime as dt
----> 4 import statsmodel.api as sm

ModuleNotFoundError: No module named 'statsmodel'

What do I do?


Solution

  • The module is statsmodels. See the documentation here.

    So the correct way to call it is

    import statsmodels.api as sm