The immediate result from using the groupby method on a DataFrame will be a groupby object. Usually, we continue operating on this object to do aggregations or transformations without ever saving it to a variable. One of the primary purposes of examining this groupby object is to inspect individual groups.
Examining the groupby object
Getting ready
In this recipe, we examine the groupby object itself by directly calling methods on it as well as iterating through each of its groups.
How to do it...
- Let's get started by grouping the state and religious affiliation...