Skip to content

BUG: Nanquantile doens't handle multidimensional q correctly #25731

@seberg

Description

@seberg

Quantile/percentile insert the dimensions of q at the beginning of the result. Nanquantile seems not to be written to correctly support multi-dimensional q and ends up splitting it up:

a = np.ones((3, 4))
q = np.full((1, 2), 0.5)
 
print(np.quantile(a, q, axis=1).shape)
# (1, 2, 3)  correct
print(np.nanquantile(a, q, axis=1).shape)
# (1, 3, 2) mangled up

The axes contributed by q of shape (1, 2) should end up at the beginning but get split.

(Reported by @aschaffer)

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