Fix solution of question 76.

This commit is contained in:
Sword-holder 2021-04-21 16:11:23 +08:00
parent 3135668de3
commit 86e24f1da9

View File

@ -1041,7 +1041,7 @@ from numpy.lib import stride_tricks
def rolling(a, window):
shape = (a.size - window + 1, window)
strides = (a.itemsize, a.itemsize)
strides = (a.strides[0], a.strides[0])
return stride_tricks.as_strided(a, shape=shape, strides=strides)
Z = rolling(np.arange(10), 3)
print(Z)