Conversion rates by age

Aggregate conversion rate tells us the overall performance of our marketing campaign. However, it does not give us that much insight. When we are reporting and tracking the progress of marketing efforts, we typically would want to dive deeper into the data and break down the customer base into multiple segments and compute KPIs for individual segments. We will first break our data into smaller segments by age and see how the conversion rates differ by different age groups.

We will look at the following code first:

conversions_by_age = df.groupby(    by='age')['conversion'].sum() / df.groupby(    by='age')['conversion'].count() * 100.0

As you can see from this code, we are using the groupby function to calculate conversion ...

Get Hands-On Data Science for Marketing now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.