Analyzing user preferences

To understand the true impact of the bug, it is crucial to determine how many subscribers we would have expected had there been no language error. This is crucial to understanding the scale of the problem and how important it is to prevent this kind of error in the future.

In this step, you will create a new DataFrame that you can perform calculations on to determine the expected number of subscribers. This DataFrame will include how many users prefer each language by day. Once you have the DataFrame, you can begin calculating how many subscribers you would have expected to have had the language bug not occurred.

This exercise is part of the course

Analyzing Marketing Campaigns with pandas

View Course

Exercise instructions

  • Group house_ads by date_served and language_preferred.
  • Use a dictionary within a call to .agg() to calculate the number of unique users and sums the number of converted users.
  • Unstack converted at level = 1

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

# Group house_ads by date and language
converted = house_ads.groupby(____)\
                        .agg({'____':'____',
                              '____':'____'})

# Unstack converted
converted_df = pd.DataFrame(____.____(____))