Skip to content

Instantly share code, notes, and snippets.

View dimejimudele's full-sized avatar
🎯
Focusing

Oladimeji Mudele dimejimudele

🎯
Focusing
View GitHub Profile
@dimejimudele
dimejimudele / rolling_window.py
Created December 4, 2018 09:04 — forked from seberg/rolling_window.py
Multidimensional rolling_window for numpy
def rolling_window(array, window=(0,), asteps=None, wsteps=None, axes=None, toend=True):
"""Create a view of `array` which for every point gives the n-dimensional
neighbourhood of size window. New dimensions are added at the end of
`array` or after the corresponding original dimension.
Parameters
----------
array : array_like
Array to which the rolling window is applied.
window : int or tuple