2017-06-01 159 views
3

python的新功能在這裏。statsmodels.formula.api importError:無法導入名稱'TimeSeries'

使用下列內容: 蟒蛇 - V1.3.1 Spyder的 - v3.1.4 的Python - V3.5

我試圖導入以下庫:

import numpy as np 
import matplotlib.pyplot as plt 
import pandas as pd 
import statsmodels.formula.api as sm 

它不斷給我出現以下錯誤:

import statsmodels.formula.api as sm 
Traceback (most recent call last): 

    File "<ipython-input-2-2515cefb61aa>", line 1, in <module> 
    import statsmodels.formula.api as sm 

    File "//anaconda/lib/python3.5/site-packages/statsmodels/formula/api.py", line 1, in <module> 
    from statsmodels.regression.linear_model import GLS 

    File "//anaconda/lib/python3.5/site-packages/statsmodels/regression/__init__.py", line 1, in <module> 
    from .linear_model import yule_walker 

    File "//anaconda/lib/python3.5/site-packages/statsmodels/regression/linear_model.py", line 52, in <module> 
    import statsmodels.base.model as base 

    File "//anaconda/lib/python3.5/site-packages/statsmodels/base/model.py", line 5, in <module> 
    from statsmodels.base.data import handle_data 

    File "//anaconda/lib/python3.5/site-packages/statsmodels/base/data.py", line 8, in <module> 
    from pandas import DataFrame, Series, TimeSeries, isnull 

ImportError: cannot import name 'TimeSeries' 

我讀了一些關於更新熊貓的文章。我嘗試過,但它不起作用。關於錯誤和解決方案的任何想法? (它正常工作時,我只導入statsmodel.formula或只是statsmodel)

+0

會發生什麼? – Jarad

回答

7

升級statsmodels工作對我來說,當你從熊貓做`導入已TimeSeries`

pip install statsmodels --upgrade

+2

如果使用Anaconda,'conda upgrade statsmodels'可能會更適合未來的版本兼容性 –

相關問題