Aan de slagGa gratis aan de slag

Create lots of groups

You want to find the mean Age of adults when grouping by the following categories:

  • "Workclass" (which has 9 categories)
  • "Above/Below 50k" (which has 2 categories)
  • "Education" (which has 16 categories).

You have developed the following bit of code:

gb = adult.groupby(by=[ "Workclass",
                        "Above/Below 50k", 
                        "Education"])

How many groups are in the gb object and what is the maximum possible number of groups that could have been created? The dataset adult, and the gb object have been preloaded for you.

Deze oefening maakt deel uit van de cursus

Working with Categorical Data in Python

Cursus bekijken

Praktische interactieve oefening

Zet theorie om in actie met een van onze interactieve oefeningen.

Begin met trainen