AttributeError:'Series'对象没有'rolling'属性

时间:2017-08-08 12:31:42

标签: python pandas

Traceback (most recent call last):
  File "mov_avg.py", line 9, in <module>
    data_frame['100ma']= data_frame['Adj Close'].rolling(window=100, min_periods=0).mean()
  File "/usr/lib/python3/dist-packages/pandas/core/generic.py", line 2360, in __getattr__
    (type(self).__name__, name))
AttributeError: 'Series' object has no attribute 'rolling'

1 个答案:

答案 0 :(得分:7)

很可能您使用的是旧版Pandas版本(&lt; 0.18.0)。

Pandas 0.18.0已添加

Series.rolling