SpinTheMic
Pro

Interview practice question

Building a cohort retention table in pandas

Data Analyst · Python and Pandas · Intermediate

How would you build a monthly cohort retention table in pandas from an orders DataFrame?

What a strong answer covers

Your AI report card counts how many of these ideas you cover.

  • Cohort = first order month per customer (groupby min / transform).
  • Order month and month offset.
  • nunique customers by cohort and offset.
  • pivot_table to matrix.
  • Divide by cohort size.
Practise this topic

Start without signing up. Sign in free to get an AI report card on your answer.

See all topics