Sub topic 8
Pitfalls: incomplete periods, small cohorts, and mixed users
This chapter assumes you can build a cohort retention table like the one from the earlier chapter. You should be comfortable with pandas groupby and with the idea of cohort age. Three mistakes account for most wrong readings of a retention table. Each one can make a product look better or worse than it is.
Pitfall 1: incomplete periods
A cohort table has a triangular shape. The January cohort has had several months to show behavior. The most recent cohort has had only one. If you export the table and fill the missing cells with zero, the newest cohorts look like they lost everyone.
There is a second form of this error. The current month is only partly finished. A cohort's latest cell can be low simply because the month has not ended.
The fix is to blank out any cell for a period that has not fully happened. This code compares each cohort's age with the latest month in the data and masks the cells beyond it.
import numpy as np
import pandas as pd
events = pd.DataFrame({
"user_id": [1, 1, 1, 2, 2, 3, 3, 4, 5, 5],
"ts": pd.to_datetime([
"2026-01-05", "2026-02-10", "2026-03-03",
"2026-01-20", "2026-02-15",
"2026-02-02", "2026-03-12",
"2026-02-18",
"2026-03-05", "2026-03-20",
]),
})
events["month"] = events["ts"].dt.to_period("M")
events["cohort"] = events.groupby("user_id")["month"].transform("min")
events["age"] = (
(events["month"].dt.year - events["cohort"].dt.year) * 12
+ (events["month"].dt.month - events["cohort"].dt.month)
)
active = (
events.groupby(["cohort", "age"])["user_id"]
.nunique()
.unstack(fill_value=0)
)
retention = active.div(active[0], axis=0)
last = events["month"].max()
max_age = np.array([
(last.year - c.year) * 12 + (last.month - c.month)
for c in retention.index
])
observed = retention.columns.to_numpy()[None, :] <= max_age[:, None]
print(retention.where(observed).round(2))Cells that have not happened now show as NaN, not 0.00. If the last month in your data is still in progress, drop it or treat it as incomplete too.
Pitfall 2: small cohorts
Retention is a percentage, and a percentage from a few users is noisy. In the example above, the February cohort has only two users. One person returning or not moves its retention by 50 points. A drop from 60% to 40% in a cohort of 10 users is one or two people.
Checks that help:
- Show the cohort size (the age 0 count) beside every row.
- Do not draw conclusions from cohorts below a size you set in advance. Many teams use roughly 100 users as a rough floor, but the right number depends on how large a difference you care about.
- Merge small weekly cohorts into monthly ones, or monthly into quarterly, to get more users per row.
- Where you can, add a confidence interval to the rate. The interval will be wide for small cohorts, and that width is the information.
Pitfall 3: mixed users
A cohort row mixes everyone who started that month. If that group includes very different kinds of users, the blended curve describes none of them. Common mixes:
- Paid and free users, or trial and converted users.
- Customers from different channels, such as a launch on a news site versus steady search traffic.
- Different plans, company sizes, or countries.
- Real users and internal staff, test accounts, or bots.
A single launch spike can also cause trouble. Thousands of curious visitors arrive in one month and most leave, which drags that cohort's curve down. Later, quieter cohorts look "better" even though the product did not change. The reverse also happens: a strong segment hides a weak one, so the average looks acceptable while most new users leave.
The blended 25% in the diagram suggests a mediocre product. In fact, one group retains well and the other does not. The next chapters on segmentation show how to split the cohort and find the users for whom the product works. For now, remove obvious noise first: internal accounts, bots, and test users.
A quick checklist
- Are all unobserved cells blank, not zero?
- Is the current, unfinished period excluded?
- Is the cohort size shown, and is it large enough to trust?
- Could one channel, plan, or launch event be distorting a row?
Exercise
A cohort table shows the newest cohort (started last week) with 0% retention at age 1 month. Your colleague says the product just got much worse. What is the most likely explanation, and what should you do?
Show answer
Age 1 month has not happened yet for that cohort, so the cell is unobserved, not zero. It was probably filled with zero by mistake. Mask cells beyond the latest observed period so they show as blank, and compare only cohorts at ages that have fully elapsed.