ComeçarComece de graça

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 exercício faz parte do curso

Reshaping Data with pandas

Ver curso

Exercício interativo prático

Experimente este exercício completando este código de exemplo.

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

# Print obesity_mean
print(obesity_mean)
Editar e executar o código