How to calculate rolling / moving average using python + NumPy / SciPy?
If you just want a straightforward non-weighted moving average, you can easily implement it with np.cumsum, which may be is faster than FFT based methods: EDIT Corrected an off-by-one wrong indexing spotted by Bean in the code. EDIT def moving_average(a, n=3) : ret = np.cumsum(a, dtype=float) ret[n:] = ret[n:] – ret[:-n] return ret[n – 1:] … Read more