CommencerCommencer gratuitement

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.

Cet exercice fait partie du cours

Customer Analytics and A/B Testing in Python

Afficher le cours

Instructions

  • 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.

Exercice interactif pratique

Essayez cet exercice en complétant cet exemple de code.

# 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()
Modifier et exécuter le code