Is there a way in numpy to retrieve all items in an array except the item of the index provided.
x =
array([[[4, 2, 3],
[2, 0, 1],
[1, 3, 4]],
[[2, 1, 2],
[3, 2, 3],
[3, 4, 2]],
[[2, 4, 1],
[0, 2, 2],
[4, 0, 0]]])
and by asking for
x[not 1,:,:]
you will get
array([[[4, 2, 3],
[2, 0, 1],
[1, 3, 4]],
[[2, 4, 1],
[0, 2, 2],
[4, 0, 0]]])
Thanks
In [42]: x[np.arange(x.shape[0])!=1,:,:]
Out[42]:
array([[[4, 2, 3],
[2, 0, 1],
[1, 3, 4]],
[[2, 4, 1],
[0, 2, 2],
[4, 0, 0]]])
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With