Skip to content

Consistent behavior for array.sum(axis_from_another_array) vs array[axis_from_another_array].sum(axis_name) #1138

@gdementen

Description

@gdementen

array[axis_from_another_array] takes the labels into account while array.sum(axis_from_another_array) does an axis aggregation (and thus ignores the labels).

>>> arr = la.ndtest(3)
>>> arr
a  a0  a1  a2
    0   1   2
>>> arr2 = la.ndtest(4)
>>> arr2
a  a0  a1  a2  a3
    0   1   2   3
>>> arr2[arr.a]
a  a0  a1  a2
    0   1   2
>>> # should be 3, not 6
... arr2.sum(arr.a) 
6

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions