rougier/numpy-100

Alternative Solution to Q76

RibsonZ opened this issue · 1 comments

Since the numpy reference advises against using "numpy.lib.stride_tricks.as_strided" when possible, I came up with another solution:

Z = np.random.randint(1,20,10)
window = 4
indices = np.arange(Z.size - window + 1)[:,None] + np.arange(window)
X = Z[indices]
print(X)

Where is it advised not to use it exactly?