Calculating retention rate
In this exercise, you will calculate the retention rate, or the number of remaining subscribers from the users who converted to your product. This can give you a sense of whether your marketing campaign converted subscribers who were actually interested in the product.
Conversion rate and retention rate function hand-in-hand; you could create a business with a high conversion rate by giving users a free trial, but have a low retention rate once users are charged for your services. This isn't inherently a bad thing, but it is important to provide your business stakeholders with insight into what percentage of users remain subscribers.
The formula for retention rate is:
$$ \frac{\text{Number of people who remain subscribed}}{\text{Total number of people who converted}} $$
This is a part of the course
“Analyzing Marketing Campaigns with pandas”
Exercise instructions
- Calculate the number of subscribers using the
user_id
andconverted
columns in themarketing
DataFrame. - Calculate the number of retained subscribers using the boolean columns
user_id
andis_retained
. - Calculate the retention rate.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Calculate the number of subscribers
total_subscribers = ____
# Calculate the number of people who remained subscribed
retained = ____
# Calculate the retention rate
retention_rate = ____
print(round(retention_rate*100, 2), "%")