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
gdementen
changed the title
Group aggregate has wrong (and different than getitem!) behavior for igroups from another axis
Group aggregate has wrong (and different than getitem!) behavior for groups from other axes
Oct 2, 2024
In fact, the problem caused by that line is present for LGroup too (but there only for slice groups):
>>>arr=ndtest(3)
>>>arraa0a1a2012>>>a2=Axis('a=a0,a2,a1')
>>>arr.sum(arr.a['a0:a1']) ==1>>>arr.sum(a2['a0:a1']) # should be 31
And in fact, I just noticed I had already found and fixed this bug in one of my local branches (slice_groups_incompatible_axis) almost two years ago. Pffff... 😭
I am not 100% sure we should have this retarget behavior in the first place. Both can be confusing. But I am 100% sure getitem and group aggregate should behave the same.
Now let us define another array with the same axis name, and reuse the
g
group:For getitem, the group is retargeted to the "local array" axis (i.e. arr2.a) by using the labels corresponding to the group on the original axis:
But for group aggregates, this is the position, irrespective of the label:
This is because of the:
line in AxisCollection._guess_axis which should probably use retarget_to instead.
The text was updated successfully, but these errors were encountered: