I have 3D array with (1000, 256, 256) shape. I want to take away the 100-200th entry from the x dimension (with 1000 items). Writing [0:100, 101:1001] makes the cut from the second dimension (with 256 items).
How do I index it?
I have 3D array with (1000, 256, 256) shape. I want to take away the 100-200th entry from the x dimension (with 1000 items). Writing [0:100, 101:1001] makes the cut from the second dimension (with 256 items).
How do I index it?
You have two options. Either slice two times and concatenate manually:
arr = np.random.rand(1000, 256, 256)
arr2 = np.vstack((arr[:100], arr[200:]))
Or use np.delete
:
arr3 = np.delete(arr, slice(100, 200), axis=0)
Both results are equal:
np.all(arr2 == arr3)
# Out: True