NumPy extends Python subscript notation, and if you want to take all the elements on an axis, you can take them by specifying :
.
Example Execution:
>>import numpy as np
>>arr=np.zeros (72, 12, 10, 4501)
>>arr.shape
(72, 12, 10, 4501)
>>arr1=arr[:,5,:,:]#Try the fifth line.
>>arr1.shape
(72, 10, 4501)
For more information, see the Indexing in the NumPy document.
© 2025 OneMinuteCode. All rights reserved.