Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Lære Challenge: Advanced Segmentation and Retention | s1
Cohort Analysis with Python
Seksjon 1. Kapittel 7
single

single

Challenge: Advanced Segmentation and Retention

Sveip for å vise menyen

To complete this challenge, follow these steps:

  • Use a pandas DataFrame containing user activity data, with columns such as user_id, acquisition_month, region, and activity_month;
  • Segment the users by both acquisition_month and region to 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.

Oppgave

Sveip for å begynne å kode

Segment the dataset by acquisition month and calculate retention rates for each cohort.

  • Group users by acquisition_month to 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, and retention_rate.

Løsning

Switch to desktopBytt til skrivebordet for virkelighetspraksisFortsett der du er med et av alternativene nedenfor
Alt var klart?

Hvordan kan vi forbedre det?

Takk for tilbakemeldingene dine!

Seksjon 1. Kapittel 7
single

single

Spør AI

expand

Spør AI

ChatGPT

Spør om hva du vil, eller prøv ett av de foreslåtte spørsmålene for å starte chatten vår

some-alt