8000 masked median of empty dimension fails · Issue #8703 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content
masked median of empty dimension fails #8703
@juliantaylor

Description

@juliantaylor
a = np.ma.masked_array(np.array([], dtype=float, ndmin=3))
np.ma.median(a, axis=2)

fails with

IndexError: index -1 is out of bounds for axis 2 with size 0

As integer indexing of empty slices does not work.
Normal median slices instead and returns the mean of an empty slice, so nan.

What should masked median return? a masked nan to somewhat match the normal median or an empty array again?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0