我试图使用statsmodels
(sm)让HP过滤器正常工作。
文档here表示sm.tsa
已存在模块0.6.1
,但我收到以下错误:
>>> import statsmodels as sm
>>> sm.__version__
'0.6.1'
>>> sm.tsa.filters.hp_filter.hpfilter()
Traceback (most recent call last):
File "<input>", line 1, in <module>
AttributeError: 'module' object has no attribute 'tsa'
>>> sm.tsa
Traceback (most recent call last):
File "<input>", line 1, in <module>
AttributeError: 'module' object has no attribute 'tsa'
这是我的pip
输出:
nat-oitwireless-inside-vapornet100-a-14423:prog2 foobar$ pip show statsmodels
---
Name: statsmodels
Version: 0.6.1
Location: /usr/local/lib/python2.7/site-packages/statsmodels-0.6.1-py2.7-macosx-10.9-x86_64.egg
Requires:
答案 0 :(得分:10)
您需要import statsmodels.api as sm