Skip to content

ENH: Unify API of groupby.sum and sum #46635

Closed
@phil20686

Description

@phil20686

Is your feature request related to a problem?

The level keyword in sum is marked as deprecated, but the suggested replacement with groupby.sum does not support skipna, therefore, some behaviours are impossible to replicate easily.

Describe the solution you'd like

grouby.sum should accept the skipna=False keyword,

API breaking implications

Currently the API is inconsistent, since
df.sum(axis=1, level=0, skipna=False) has no equivalent since df.groupby(axis=1, level=0).sum(skipna=False) is not available.

Describe alternatives you've considered

One can of course do: df.groupby(axis=1, level=0).apply(lambda x : x.sum(axis=1, skipna=False)) but this cannot be the intended use.

Additional context

image

# Your code here, if applicable

Metadata

Metadata

Assignees

No one assigned

    Labels

    API - ConsistencyInternal Consistency of API/BehaviorDuplicate ReportDuplicate issue or pull requestEnhancementGroupbyMissing-datanp.nan, pd.NaT, pd.NA, dropna, isnull, interpolateNeeds DiscussionRequires discussion from core team before further action

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions