runmean

runmean(y, n, /, wintype='boxcar', axis=- 1, pad=nan)[source]

Apply running average to array.

Parameters
  • y (array-like) – Data, and we roll along axis axis.

  • n (int, optional) – Window length. Passed to window.

  • wintype (int or array-like) – Window type. Passed to window.

  • axis (int, optional) – Axis to filter.

  • pad (bool, optional) – The pad value used to fill the array back to its original size. Set to None to disable padding.

Returns

y (array-like) – Data windowed along axis axis.

Notes

Implementation is similar to scipy.signal.lfilter. Read this post. This creates view of original array, without duplicating data, so very efficient approach.