rolmean = pd.rolling_mean(timeseries, window=12) spa
rolstd = pd.rolling_std(timeseries, window=12)pandas
expwighted_avg = pd.ewma(ts_log, halflife=12)module
會有報錯im
AttributeError: module 'pandas' has no attribute 'rolling_mean'time
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()