You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
The text was updated successfully, but these errors were encountered:
you can use a lambda function to pass the extra arguments, instead of strings. You can also prefilter, selecting only numeric columns, before running the groupby operation
you can use a lambda function to pass the extra arguments, instead of strings. You can also prefilter, selecting only numeric columns, before running the groupby operation
Agreed on each of these workarounds, though the former will be significantly ill-performant. We allow passing numeric_only on non-list inputs (e.g. gb.agg("sum", numeric_only=True)), and many other groupby-ops, I think we should be doing the same here.
The fix for #45658 would address this (internally we'd be using DataFrameGroupBy.sum instead of SeriesGroupBy.sum), but is currently blocked by the DataFrame case because of a transpose that happens with the results. That transpose behavior does not occur in groupby, and so we should be able to implement the fix proposed for #45658. First we'll need to split off the handling of groupby from that of DataFrame (I was already strongly leaning toward doing this).
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
The text was updated successfully, but these errors were encountered: