无法从statsmodels.graphics.tsaplots中导入plot_acf(导入错误)

问题描述 投票:0回答:1

[尝试从statsmodels导入plot_acf时出现错误

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-290-9212ac9a550b> in <module>
----> 1 from statsmodels.graphics.tsaplots import plot_acf

//anaconda3/lib/python3.7/site-packages/statsmodels/graphics/tsaplots.py in <module>
      5 
      6 from statsmodels.graphics import utils
----> 7 from statsmodels.tsa.stattools import acf, pacf
      8 
      9 

//anaconda3/lib/python3.7/site-packages/statsmodels/tsa/stattools.py in <module>
     12 import pandas as pd
     13 
---> 14 from statsmodels.regression.linear_model import OLS, yule_walker
     15 from statsmodels.tools.sm_exceptions import (InterpolationWarning,
     16                                              MissingDataError,

//anaconda3/lib/python3.7/site-packages/statsmodels/regression/__init__.py in <module>
----> 1 from .linear_model import yule_walker
      2 
      3 from statsmodels.tools._testing import PytestTester
      4 
      5 __all__ = ['yule_walker', 'test']

//anaconda3/lib/python3.7/site-packages/statsmodels/regression/linear_model.py in <module>
     44 from statsmodels.tools.decorators import (cache_readonly,
     45                                           cache_writable)
---> 46 import statsmodels.base.model as base
     47 import statsmodels.base.wrapper as wrap
     48 from statsmodels.emplike.elregress import _ELRegOpts

//anaconda3/lib/python3.7/site-packages/statsmodels/base/model.py in <module>
     10 from statsmodels.stats.contrast import (ContrastResults, WaldTestResults,
     11                                         t_test_pairwise)
---> 12 from statsmodels.tools.decorators import (cache_readonly,
     13                                           cached_value, cached_data)
     14 import statsmodels.base.wrapper as wrap

ImportError: cannot import name 'cached_value' from 'statsmodels.tools.decorators' (//anaconda3/lib/python3.7/site-packages/statsmodels/tools/decorators.py)

-

我尝试通过终端卸载并重新安装numpy,scipy,pandas,patsy和scipy。

我已经通过help(modules)检查了模块,起初得到了Shimwarning

(//anaconda/lib/python3.4/site-packages/IPython/kernel/__init__.py:13: ShimWarning: The `IPython.kernel` package has been deprecated. You should import from ipykernel or jupyter_client instead.
  "You should import from ipykernel or jupyter_client instead.", ShimWarning)

但是,重新安装后,我不再收到此警告,但是,当尝试从statmodels.graphics.tsaplots导入plot_acf时,仍然出现相同的错误

有人可以帮我吗?

python jupyter-notebook importerror statsmodels
1个回答
0
投票

我通过重新安装Anaconda和Jupyter Notebook解决了此问题

© www.soinside.com 2019 - 2024. All rights reserved.