← All Python interview questions

Build a monthly cohort retention matrix

HardPandas — GroupBySwiggyCred

Growth wants classic cohort retention: users grouped by their signup month, then counted by how many months later they were still active.

Write retention(df) that returns a DataFrame indexed by signup month period, with integer month offsets as columns and the count of distinct active users in each cell (0 where nobody returned).

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