IniziaInizia gratis

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.

Questo esercizio fa parte del corso

Working with Categorical Data in Python

Visualizza il corso

Esercizio pratico interattivo

Passa dalla teoria alla pratica con uno dei nostri esercizi interattivi

Inizia esercizio