Seção 1. Capítulo 7
single
Challenge: Advanced Segmentation and Retention
Deslize para mostrar o menu
To complete this challenge, follow these steps:
- Use a pandas DataFrame containing user activity data, with columns such as
user_id,acquisition_month,region, andactivity_month; - Segment the users by both
acquisition_monthandregionto create multi-level cohorts; - For each cohort, calculate the number of users retained in each subsequent month after acquisition;
- Compute the retention rate for each cohort as the percentage of users active in a given month compared to the original cohort size;
- Calculate the churn rate as 1 minus the retention rate for each period.
You will need to use pandas grouping and aggregation methods to perform these calculations efficiently.
Tarefa
Deslize para começar a programar
Segment the dataset by acquisition month and calculate retention rates for each cohort.
- Group users by
acquisition_monthto form cohorts. - For each cohort, count the number of unique users active in each month since acquisition.
- Calculate the retention rate for each cohort and period as the number of active users divided by the cohort size.
- Return a DataFrame with columns
cohort,months_since_acquisition, andretention_rate.
Solução
Tudo estava claro?
Obrigado pelo seu feedback!
Seção 1. Capítulo 7
single
Pergunte à IA
Pergunte à IA
Pergunte o que quiser ou experimente uma das perguntas sugeridas para iniciar nosso bate-papo