Skip to content

Use flox for median-aggregation in groupbys #11238

@sdiebolt

Description

@sdiebolt

Is your feature request related to a problem?

If I'm not mistaken, flox does support median/nanmedian aggregation for groupby reduce operations. But currently, while Xarray's docs indicates that median reduction on groupbys should use flox when available, I'm not sure this is actually implemented:

return self.reduce(
duck_array_ops.median,
dim=dim,
skipna=skipna,
keep_attrs=keep_attrs,
**kwargs,
)

I'm happy to open a PR if median-reductions should indeed use flox when available!

Describe the solution you'd like

Median-reduction on groupbys should use flox when available.

Describe alternatives you've considered

No response

Additional context

Currently, I resort to using flox's xarray_reduce function directly, which dramatically speeds up median-reduction.

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