Moving average using rolling_mean

Post date: Jun 30, 2015 8:36:22 PM

We use rolling_mean and shift for this. The example from:

http://stackoverflow.com/questions/20249149/rolling-mean-with-customized-window-with-pandas

data_mean = pd.rolling_mean(data, window=5).shift(-2)