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.
This exercise is part of the course
Working with Categorical Data in Python
Hands-on interactive exercise
Turn theory into action with one of our interactive exercises
Start Exercise