ComenzarEmpieza gratis

A group analysis

You are almost done working for the day, but there is an extra analysis you want to do. You want to know if the mean and median percentage of obesity by country are different.

You analyze the DataFrame obesity. You realize that country is part of the column labels, so you need to reshape the DataFrame so country is part of the index.

You want to take a different approach. You will perform the desired calculations, combining the stacking process and .groupby() function.

The obesity DataFrame is available in your session. Make sure to examine it in the console!

Este ejercicio forma parte del curso

Reshaping Data with pandas

Ver curso

Ejercicio interactivo práctico

Prueba este ejercicio y completa el código de muestra.

# Stack country level, group by country and get the mean
obesity_mean = obesity.____(level=____).____(____).____

# Print obesity_mean
print(obesity_mean)
Editar y ejecutar código