Skip to content

BUG: np.mean does not raise AxisError for illegal axes #15817

@eric-wieser

Description

@eric-wieser

Minor, but:

>>> a = np.arange(10)
>>> a.sum(axis=2)
AxisError: axis 2 is out of bounds for array of dimension 1

>>> a.mean(axis=2)
# from _count_reduce_items in methods.py
IndexError: tuple index out of range

I'd expect both to raise the same error

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions