← Courses

Pandas, Hands-On Data with Python

Data Science

Core pandas · Lesson 6 of 10

Grouping and sorting

Grouping and sorting

Real insight often comes from grouping: total sales per seller, average score per city.

  • groupby("col") gathers rows that share a value, so you can summarize each group
  • sort_values("col") puts the table in order
Python

Group, then summarize: this is one of the most powerful moves in all of data analysis.

Exercise

Exercise — check your understanding

Using the orders DataFrame in the starter, find the total quantity ordered for each product. Store the result in totals.

You’re reading for free. Sign in to keep your progress and earn a certificate when you finish.Sign in to keep my progress →