You have a users frame with a signup month and an activity frame with the months each user was active. Growth wants month-1 retention per cohort: the share of a cohort that was active in the month immediately after signup.
Write a function retention(users, activity) that returns a dictionary mapping each signup_month (an integer) to the retention rate as a float rounded to 2 decimals. Months are simple integers, so month 1 is followed by month 2.
More Pandas — Joins questions
Asked at Google
Practising alone only goes so far — our live cohorts pair Python and Pandas depth with dashboards, agentic analytics projects and mock interviews.
Explore the program