Pandas DataFrame Operations - Grouping and Sorting

We'll cover the following

6. Grouping

Things start looking really interesting when we group rows with certain criteria and then aggregate their data.

Say we want to group our dataset by director and see how much revenue (sum) each director earned at the box-office and then also look at the average rating (mean) for each director. We can do this by using thegroupby operation on the column of interest, followed by the appropriate aggregate (sum/mean), like so:

Get hands-on with 1200+ tech skills courses.