Comparing conversion rates
Now that we know allocation is relatively even let's look at the conversion rate for the control and personalization. Since we chose conversion rate as our key metrics for this test, it is highly important that we evaluate whether or not conversion was higher in the personalization treatment compared with the control. While we will dive in deeper in subsequent exercises, measuring the difference between the key metric in the control and the treatment is the most important part of evaluating the success of an A/B test.
The DataFrame email has been loaded in your workspace which contains only rows from the marketing DataFrame where marketing_channel is 'Email'.
This exercise is part of the course
Analyzing Marketing Campaigns with pandas
Exercise instructions
- Group the
emailDataFrame byuser_idandvariantwhile selecting the maximum value of theconvertedcolumn and store the results insubscribers. - Drop missing values from the
controlcolumn ofsubscribers_df. - Drop missing values from the
personalizationcolumn ofsubscribers_df. - Calculate the conversion rate for both
personalizationandcontrolusing the appropriate function for each.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Group marketing by user_id and variant
subscribers = email.____(['user_id',
____])____
subscribers_df = pd.DataFrame(subscribers.unstack(level=1))
# Drop missing values from the control column
control = ____
# Drop missing values from the personalization column
personalization = ____
print('Control conversion rate:', ____)
print('Personalization conversion rate:', ____)