We're sorry but this app doesn't work properly without JavaScript enabled. Please enable it to continue.

This lesson's interactive features are locked, please to keep using them

Cohort Retention

One of the most common visualizations for cohorts is their retention rate (percentage) by cohort. It's often drawn like this, with nice colors to highlight the decay:

To calculate it, divide each row by the cohort's initial size (month 0):

cohort_sizes = cohort_table[0]
retention = cohort_table.div(cohort_sizes, axis=0)
print(retention)

Which prints something like this:

          0     1     2
cohort
2024-01  1.0  0.67  0.67
2024-02  1.0  0.50  1.00
2024-03  1.0  1.00   NaN

Newer cohorts often have fewer columns filled in because not enough time has passed. Don't compare incomplete periods.

Why Month 0 Is Always 100%

Every cohort starts at 1.0 (100%) in month 0, because you're dividing the cohort's starting size by itself. That's the baseline. The interesting signal is how fast each row decays from there: a row that's still near 1.0 several months out is a sticky cohort, while one that drops to 0.10 has a retention problem.