-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
ENH: implement nlargest
and nsmallest
for DataFrameGroupBy like SeriesGroupBy
#46924
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Labels
API - Consistency
Internal Consistency of API/Behavior
Enhancement
Groupby
Series
Series data structure
Comments
nlargest
for DataFrameGroupBynlargest
and nsmallest
for DataFrameGroupBy like SeriesGroupBy
In fact, this can be done exactly in the same way than pandas/pandas/core/groupby/generic.py Lines 744 to 760 in 4bfe3d0
|
If still open, I would like to work on this issue. |
take |
4 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
API - Consistency
Internal Consistency of API/Behavior
Enhancement
Groupby
Series
Series data structure
The
DataFrameGroupBy
should get a new methodnlargest
to allow selecting the N largest rows for each group.Currently this is doable by using
df.sort_values(...).groupby(...).head(n)
but I want to use thekeep='all'
parameter ofnlargest
which cannot be obtained withhead
The text was updated successfully, but these errors were encountered: