pandas中没有了'rolling_mean' 'rolling_std' 'ewma'

rolmean = pd.rolling_mean(timeseries, window=12)

rolstd = pd.rolling_std(timeseries, window=12)

expwighted_avg = pd.ewma(ts_log, halflife=12)

会有报错

AttributeError: module 'pandas' has no attribute 'rolling_mean'

AttributeError: module 'pandas' has no attribute 'rolling_std'

AttributeError: module 'pandas' has no attribute 'ewma'

这是因为pandas版本跟新了,应该改为

rolmean = timeseries.rolling(12).mean()
rolstd = timeseries.rolling(12).std()

expwighted_avg = pd.DataFrame.ewm(ts_log, halflife=12).mean()

posted @ 2020-02-01 15:43  星涅爱别离  阅读(8440)  评论(0编辑  收藏  举报