Skip to content

BUG: Can't pass arguments to DataFrameGroupBy.agg when using list/dict-like and string aliases #53839

Open
@sartajsartaj

Description

@sartajsartaj

Feature Type

  • Adding new functionality to pandas

  • Changing existing functionality in pandas

  • Removing existing functionality in pandas

Problem Description

when i apply sum() on groupby object there is a option to select numeric_only columns like :

movies.groupby('Genre').sum(numeric_only = True) # movies here is imdb-top-1000.csv

but if I want to apply multiple aggregate function on ALL numeric_only columns, there is no option to write "numeric_only = True" anywhere according to documentation.
movies.groupby('Genre').agg( ['min', 'max', 'mean'] ) # This code gives error in 2.0.2 version of pandas

This wasn't a problem in earlier version (version 1.5) of pandas as it used to automatically select numerical columns.
Please fix this !
At least provide some option to write numeric_only = True like :
movies.groupby('Genre').agg( ['min', 'max', 'mean'] , numeric_only = True)

Feature Description

At least provide some option to write numeric_only = True like :
movies.groupby('Genre').agg( ['min', 'max', 'mean'] , numeric_only = True)

Alternative Solutions

At least provide some option to write numeric_only = True like :
movies.groupby('Genre').agg( ['min', 'max', 'mean'] , numeric_only = True)

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions