Closed
Description
>>> arr = ndtest((2, 4))
>>> f = arr > 2
a\b b0 b1 b2 b3
a0 False False False True
a1 True True True True
>>> arr[f]
a_b a0_b3 a1_b0 a1_b1 a1_b2 a1_b3
3 4 5 6 7
>>> f2 = f['b0,b2,b3']
>>> f2
a\b b0 b2 b3
a0 False False True
a1 True True True
>>> arr[f2]
a_b\b b3 b0 b2 b3
a0_b3 3 0 2 3
a1_b0 7 4 6 7
a1_b2 7 4 6 7
a1_b3 7 4 6 7
This is complete junk.
I see three options going forward:
- raise an error when common axes between filter.axes and array.axes are not equal
- behave as if the filter was False where not present (possibly check that filter.axes are subsets of array.axes). I think that numpy previously had the equivalent of this behavior but no longer support this.
- align filter.axes with array.axes, so that if filter.axes has more axes (unsure what happens in this case currently) or more labels on common axes, the result has more labels too.
Currently, I think it would be best to implement 1, until we implement align by default for all operations, in which case 3. would make more sense. I might revise my judgment on option 2 if it turns out absolutely necessary to solve #1084.
FWIW, I don't think this is worth blocker priority even though this is a "silent" failure because the extra "combined" axis would be very quickly spotted by users.