Skip to content

ENH: Use sequence of ints instead of tuple of ints in the axis parameter for mean, sum, min, max, etc. #21136

Open
@kadykov

Description

@kadykov

Proposed new feature or change:

Numpy has many functions that support operations over multiple dimensions like min, max, mean, average, sum, etc.
All of them has axis parameter to specify the axes along which the function has to be applied.

In most cases, the accepted types for this parameter are None, int, and a tuple of ints, like in ptp, percentile, nanpercentile, quantile, nanquantile, average, mean, std, var, nanmean, nanstd, nanvar, sum, prod, nanprod, nansum, and gradient.

Is there any reason not to use a sequence of ints for the axis parameter where a tuple of ints is allowed?

For instance, the functions median and nanmedian support a sequence of ints, therefore users can use sets and frozensets to skip unnecessary checks for repeated values.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions