343-8 - Index labels of grouped dataframe

Aggregate Data With Pandas | Dataquest

How do we know that this is true ? That region is the new index in grouped.mean() ?
How can we check for index labels?

Here is one simple way:


What do you see when you try this?

That’s the intended functionality of groupby(). If you check the documentation, it has the following parameter -

as_index bool, default True

For aggregated output, return object with group labels as the index. Only relevant for DataFrame input. as_index=False is effectively “SQL-style” grouped output.

You can run print grouped_dataframe_object.describe(). Since it’s a groupby object, it is possible that not all methods applicable to dataframes would work on it.