I have the following 3D array of shape
In [159]: arr = np.arange(60).reshape(3, 4, 5)
And I'm trying to do advanced indexing to extract a sub-array like:
# behaves as expected
In [160]: arr[[1, 2], :, 1].shape
Out[160]: (2, 4)
In the following case, I'd expect the result to be of shape (4, 2).
# unintended behaviour
In [161]: arr[1, :, [1, 2]].shape
Out[161]: (2, 4)
Since we do __getitem__ call along first dimension that dimension would be gone. Along the second axis, we slice everything so it should be 4 and along the last axis it should be 2. So, we should get the resulting sub-array of shape (4, 2) but we get a shape of (2, 4) instead. Why is this ambiguity? How should I interpret the result?