Skip to content

ENH: Support reduction methods on Index(?) #50021

Open
@mroeschke

Description

@mroeschke

Feature Type

  • Adding new functionality to pandas

  • Changing existing functionality in pandas

  • Removing existing functionality in pandas

Problem Description

In theory, a numeric Index could support reduction functions as a "1D list-like object" and closer align to Series in this way as well. Of course reduction functions might not make sense on some Index subclasses (MultiIndex, IntervalIndex, etc)

cuDF Index supports reduction functions and are considering deprecating them to align with the pandas Index API, but opening this issue to gauge whether pandas actually wants to support reduction functions on Index rapidsai/cudf#12284

Current reduction functions supported on Series:

pandas/pandas/conftest.py

Lines 1036 to 1048 in 36dcf51

_all_numeric_reductions = [
"count",
"sum",
"max",
"min",
"mean",
"prod",
"std",
"var",
"median",
"kurt",
"skew",
"sem",

Feature Description

Defining _reduce on Index which can dispatch to EA._reduce if an EA type or use a nanop method otherwise?

Alternative Solutions

index.to_series().<reduction_op>(...)

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    EnhancementIndexRelated to the Index class or subclassesNeeds DiscussionRequires discussion from core team before further actionReduction Operationssum, mean, min, max, etc.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions