How do I change the rolling window function size to be a 2x3 window as opposed to the 3x3 window it is at right now? I am not skilled enough and have no idea how to reverse engineer the function to understand how window_size works :(
import numpy as np
def rolling_window(array, window_size):
itemsize = array.itemsize
shape = (array.shape[0] - window_size + 1,
array.shape[1] - window_size + 1,
window_size, window_size)
strides = (array.shape[1] * itemsize, itemsize,
array.shape[1] * itemsize, itemsize)
return np.lib.stride_tricks.as_strided(array, shape=shape, strides=strides)
roller = np.arange(1,16).reshape(3,5)
print(roller)
run = rolling_window(roller,3)
print(run)