I think I understand the indexing of array in python/numpy correctly. But today I met a problem as follows:
I have a 6-d array e.g. A
and A.shape = (11,1,9,1,5,7)
.
Then I use the indexing as follows:
B = A[:,0,0,0,[3,4,2],0]
and B.shape = (11,3)
as expected;
C = A[:,0,0,0,[3,4,2],:]
and C.shape = (11,3,7)
as expected;
But when I say:
D = A[:,0,:,0,[3,4,2],0]
and D.shape
should be (11,9,3)
as I can expect, however, python returned the D.shape = (3, 11, 9)
.
And I'm really confused about the shape of array D
.
Is there any one can give me a brief explanation? Thanks a lot!