Merge pull request #148 from Sword-holder/master

Fix solution of question 76.
This commit is contained in:
Nicolas P. Rougier 2021-04-26 09:31:08 +02:00 committed by GitHub
commit 22f47a6e0b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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)