0

I have a Numpy array of thousands of values like:

[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]

and I'd like to reshape the array to be able to vectorize a calculation on segments of the array of fixed-width like this:

[[0, 1, 2, 3],
 [1, 2, 3, 4],
 [2, 3, 4, 5],
 ...]

What's the most efficient way to do this?

Brett Morris
  • 791
  • 1
  • 4
  • 13

0 Answers0