1. Customer segmentation
In this lesson, we will focus on customer segmentation.
2. Common ways to segment audiences
In addition to high-level metrics, it's important to segment customers by who you're marketing to.
Segmenting means breaking down metrics by specific characteristics.
For instance, in addition to looking at conversion rates overall, you might also want to look at conversion rate by age group. It's possible that a campaign had a low conversion rate overall, but was super effective for users who were 55 years and up.
Rather than calling the campaign a failure, your team has learned a new way to market to older individuals! That's great news! You could use these results to conduct a campaign where users 55 years and up receive a different marketing technique than everyone else.
3. Segmenting using pandas
One way to segment is by subscribing channel.
Let's check the retention rate for users who converted by clicking on a House Ad. To do this, we first subset the DataFrame to include data only for House Ads, that is, where subscribing_channel equals House Ads.
Using the house_ads DataFrame, you can calculate retention rate like before, dividing the total number of users retained by the number of subscribers who originally subscribed through a House Ad.
That's great! But how do you know if this retention rate is good or bad? Ideally, you will compare retention rates across all channels to determine whether some channels perform better than others.
4. There must be an easier way to segment!
The previous method is great if you only care about some of the sub-segments that are in your dataset. However, recalculating retention rate can get tedious if you want to compare across all channels.
5. Segmenting using pandas - groupby()
This is when the flexibility of pandas comes in handy! You can use the groupby() method to analyze and calculate statistics for multiple sub-segments in your data.
Here we first subset the data to include only the customers who were retained and then group by subscribing_channel. Then, we count the number of unique user ids to find the total number of retained customers per channel.
6. Segmenting using pandas - groupby()
Similarly, we subset the data to include the customers who subscribed, group by subscribing_channel and count the number of unique user ids to find the total number of subscribers for each channel.
7. Segmenting results
Finally, you can divide the number of retained customers by the total number of subscribers to find the retention rate for each channel.
And here are our results. It appears email has the highest retention rate among our marketing channels.
8. Let's practice!
It's time for you to calculate metrics for different segments in the data.