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()