无法在 jupyter notebook 上导入 statsmodels

Unable to import statsmodels on jupyter notebook

我已经安装了 statsmodels,它说“要求已经满足”,但是当我导入它时,我得到一个模块不存在的错误。

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'

我该怎么办?

模块是statsmodels。请参阅文档 here

所以正确的称呼方式是

import statsmodels.api as sm