Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Introduction
Grouping
11. Function size()
Summary

Instruction

Good! Once we have our rows grouped, we can run various statistical functions on them. Let's start with size():

players_by_height = players.groupby('height')
players_by_height.size()

We'll see something like:

180 1
185 3
191 2
198 3
203 1
dtype: int64

The size() function shows the number of rows in each group. You can use it as a starting point to check whether groups were created correctly.

Exercise

Use the size() function on the rows grouped by country.

As you can see, the country with the most movies is the USA, and the country with the fewest movies is Russia.

Stuck? Here's a hint!

Simply add size() after a dot to the movies_by_country variable.