You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Advanced indexing sometimes gives the result transposed w.r.t. the expected result.
This occurs when indexing by (int, slice, list), but not (int, slice, slice) or (slice, int, list).
Example:
>>> np.version.full_version
'1.9.3'
>>> a = np.arange(24).reshape((4, 3, 2))
This is actually the documented behavior: the first and last index are considered to be fancy indices, and when more than one non-contiguous axis is fancy-indexed, the result of indexing those axes is grouped before any of the non-fancy indexed axes.
It's confusing, and there is an ongoing discussion to provide a more intuitive indexing, see #6075 and #6256, but it is not a bug, but a feature!
I'm going to close this, but feel free to continue the discussion if you need clarification.
Advanced indexing sometimes gives the result transposed w.r.t. the expected result.
This occurs when indexing by (int, slice, list), but not (int, slice, slice) or (slice, int, list).
Example:
Incorrect:
Correct:
The incorrect result is the transpose of the correct one:
The text was updated successfully, but these errors were encountered: