ComeçarComece de graça

Visualizing user spending

Recently, the Product team made some big changes to both the Android & iOS apps. They do not have any direct concerns about the impact of these changes, but want you to monitor the data to make sure that the changes don't hurt company revenue. Additionally, the product team believes that some of these changes may impact female users more than male users.

In this exercise you're going to plot the monthly revenue for one of the updated products and evaluate the results.

The dataset user_revenue containing the 'device', 'gender', 'country', 'date', and 'revenue' has been loaded. It has been grouped by month, device, and gender. Note that here, a 'month' column has been extracted from the 'date' column.

Este exercício faz parte do curso

Customer Analytics and A/B Testing in Python

Ver curso

Instruções do exercício

  • Pivot user_revenue such that we have the 'month' as the rows (index),'device' and 'gender' as our columns and 'revenue' as our values.
  • Remove the first and last row of the DataFrame once pivoted to prevent discontinuities from distorting the results. This has been done for you.
  • Plot pivoted_data using its .plot() method.

Exercício interativo prático

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

# Pivot user_revenue
pivoted_data = pd.pivot_table(user_revenue, values =_____, columns=['device', _____], index='month')
pivoted_data = pivoted_data[1:(len(pivoted_data) -1 )]

# Create and show the plot
pivoted_data.____
plt.show()
Editar e executar o código