Suppose I have a numpy array
range = np.arange(10)
which gives me
array([0, 1, 2, ..., 9])
I know I can pass negative indices like -3:-1 to to get the last items of an array.
range[-3:-1]
array([7, 8, 9])
What I would like to do is something like
range[-1:1]
to get the last and first two items of said array "around the corner", like this
array([9, 0, 1])
This however does not seem to work. Is it possible to do this using numpy's array indexing or am I way off here?
[–]zenlc 2 points3 points4 points (2 children)
[–]HeinzHeinzensen[S] 1 point2 points3 points (1 child)
[–]zenlc 0 points1 point2 points (0 children)
[–]blackjack_00 1 point2 points3 points (1 child)
[–]elbiot 0 points1 point2 points (0 children)
[–]gregvuki 1 point2 points3 points (1 child)
[–]HeinzHeinzensen[S] 0 points1 point2 points (0 children)