Confusing about the shape of ndarray

18 views Asked by At

I am a little confused about the shape of 3d ndarray. The numpy version is 1.24.2.

import numpy as np

a = np.zeros((10,3,4))

print(a.shape)
print(a[1,:,:].shape)
print(a[1,:,0:4].shape)
print(a[1,:,range(0,4)].shape)

The results of the first three outputs were expected: 10,3,4; 3,4; 3,4. However, the last output was 4,3 which is quite confusing.

0

There are 0 answers