Is there a SciPy function or NumPy function or module for Python that calculates the running mean of a 1D array given a specific window?
Instead of numpy or scipy, I would recommend pandas to do this more swiftly:
df['data'].rolling(3).mean()
This takes the moving average (MA) of 3 periods of the column "data". You can also calculate the shifted versions, for example the one that excludes the current cell (shifted one back) can be calculated easily as:
df['data'].shift(periods=1).rolling(3).mean()