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.
Este exercício faz parte do curso
Analyzing Marketing Campaigns with pandas
Instruções do exercício
- Group
house_ads
bydate_served
andlanguage_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
atlevel = 1
Exercício interativo prático
Experimente este exercício completando este código de exemplo.
# Group house_ads by date and language
converted = house_ads.groupby(____)\
.agg({'____':'____',
'____':'____'})
# Unstack converted
converted_df = pd.DataFrame(____.____(____))