>> np.arange(24).reshape(2,3,4)[0,:,[2,3]].shape
(2,3)
>> np.arange(24).reshape(2,3,4)[0,[1,2],:].shape
(2,4)
I get the second one, but why the first one is not (3,2)
?
In the first case, the first two indices (0
and :
) are basic indexing, and the last one ([2,3]
) is advanced indexing.
According to the guide, deal with the basic indexing first (producing (3,4)
-shaped view), then with advanced indexing it would get (3,2)
-shaped copy. It looks like the single integer index (0
) becomes advanced indexing, which makes no sense.