pandas · Lesson 5.4 · Pro
Top N per group and group filters
The best few rows in every group, and keeping or dropping whole groups by a rule.
In this lesson
- Sort, then head per group
- The single best row per group
- Keep whole groups by a rule
- Rank inside groups
Go Pro to read this lesson
Pro unlocks every lesson and practice problem in SQL, Python, pandas and NumPy, with answers and step-by-step explanations.