Skip to content

ENH: implement nlargest and nsmallest for DataFrameGroupBy like SeriesGroupBy #46924

Open
@yoch

Description

@yoch

The DataFrameGroupBy should get a new method nlargest 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 the keep='all' parameter of nlargest which cannot be obtained with head

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions