Hello I am checking slicing in numpy and I have the following two codes:
arr = np.array([[1, 2, 3, 4, 5], [6, 7, 8, 9, 10]])
arr[0:2, 1:4]
that returns
[[2, 3, 4], [7, 8, 9]]
in the first case, the index go from 0 to 2
[[1, 2, 3, 4, 5], [6, 7, 8, 9, 10]]
0 1 2 3 4 0 1 2 3 4
In the first slicing [0:2] is picking 3 numbers 2th inclusive
2, 3, 4
But in the second it isn't and np only gets 3 numbers instead of 4 like in the other.
Why one of this is picking the end in this case 2, but in another case not?
For 1D the same behavior and end index are not taken into account.
Thanks.