module 'pandas' has no attribute 'rolling_mean'

Solution 1:

I believe need change:

moving_avg = pd.rolling_mean(ts_log,12)

to:

moving_avg = ts_log.rolling(12).mean()

because old pandas version code below pandas 0.18.0

Solution 2:

Change:

moving_avg = pd.rolling_mean(ts_log,12)

to:

rolmean = pd.Series(timeseries).rolling(window=12).mean()

rolstd = pd.Series(timeseries).rolling(window=12).std()