Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

numpy rolling

def rolling_window(a, window):
    shape = a.shape[:-1] + (a.shape[-1] - window + 1, window)
    strides = a.strides + (a.strides[-1],)
    return np.lib.stride_tricks.as_strided(a, shape=shape, strides=strides)
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #numpy #rolling
ADD COMMENT
Topic
Name
7+5 =