Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Alternative Solution to Q76 #107

Open
RibsonZ opened this issue Apr 1, 2020 · 1 comment
Open

Alternative Solution to Q76 #107

RibsonZ opened this issue Apr 1, 2020 · 1 comment

Comments

@RibsonZ
Copy link

RibsonZ commented Apr 1, 2020

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)
@rougier
Copy link
Owner

rougier commented Apr 13, 2020

Where is it advised not to use it exactly?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants