Arron Bennett, Founder of Bennett Financials
"How long does a client stay with you?"
It sounds like a question with an obvious answer. Pull the clients who left, average how long they lasted, done.
That answer is wrong, and usually wrong by a lot. In the example below it says 13.5 months when the real figure is closer to three years.
This article shows why, and builds a correct estimate with pandas in about ten lines. No special libraries.
Key takeaways
- Averaging the clients who left understates lifetime, because your longest-staying clients haven't left yet.
- Averaging everyone's months so far also understates it, because active clients are still going.
- A survival curve uses both groups correctly. It can be built with a groupby.
- The curve shows when clients leave, which is more useful than a single average.
- Lifetime drives what a client is worth, so getting it wrong distorts every growth decision.
Why is the simple average wrong?
It's wrong because the data is incomplete in a specific way. For clients who left, you know their full lifetime. For clients still with you, you only know they've lasted at least this long. Statisticians call that censored data. Throwing those clients away, or treating their time so far as final, biases the answer downward.
Think about who's in the "left" group. A client who signed five years ago and is still here isn't in it. A client who signed five years ago and quit in month three is. The group of leavers is packed with short stays by construction.
Now the other shortcut: average the months billed so far across all clients. Better, but a client who joined four months ago and is perfectly happy gets counted as a four-month client.
Setting up the data
Here's a hypothetical example. Every number is made up to show the method.
A 12-person agency sells website maintenance retainers. Revenue is $1.9 million. It has six years of billing history covering 400 clients, and wants to know how long a client typically stays.
All you need from a real billing export is three things per client: the first invoice month, the last invoice month and whether they're still active. I'm simulating that here so the code runs as-is. The simulation has one deliberate feature: clients are more likely to leave in their first six months than later.
import numpy as np import pandas as pd rng = np.random.default_rng(11) n = 400 today = pd.Period("2026-10", freq="M") # Clients signed up at random over the last six years. age = rng.integers(1, 73, n) # months since each client started # Chance of leaving each month: higher in the first six months, lower after. def months_until_leaving(): m = 0 while True: m += 1 if rng.random() < (0.045 if m <= 6 else 0.016): return m life = np.array([months_until_leaving() for _ in range(n)]) churned = life <= age # False = still a client today df = pd.DataFrame({ "start": [today - int(a) for a in age], "months": np.where(churned, life, age), # months billed so far "churned": churned, }) print(df.head(6).to_string(index=False)) print() print(f"clients: {len(df)} left: {df.churned.sum()} still active: {(~df.churned).sum()}") start months churned 2025-12 10 False 2025-12 4 True 2021-12 58 False 2023-10 6 True 2023-03 1 True 2023-02 12 True clients: 400 left: 196 still active: 204 The months column means two different things depending on churned. For a client who left, it's their whole lifetime. For an active one, it's how long they've lasted so far. That's the censoring.
Slightly more than half the clients are still active. Any method that ignores them is ignoring most of the information.
The two shortcuts
# Shortcut 1: average the clients who left. print(f"\nShortcut 1, average of clients who left: {df[df.churned].months.mean():.1f} months") # Shortcut 2: average everyone's months so far. print(f"Shortcut 2, average of everyone so far: {df.months.mean():.1f} months") Shortcut 1, average of clients who left: 13.5 months Shortcut 2, average of everyone so far: 22.1 months Two answers, nearly nine months apart, and both too low.
The survival curve
The correct approach asks a different question. Of the clients who reached month t, what share made it through month t to the next one? Multiply those shares together and you get the proportion still with you after any number of months.
This is the Kaplan-Meier estimator. A client who's been active for ten months counts in the "reached month t" group for months one to ten, then drops out of the calculation without being counted as a loss. That's how active clients contribute what they know and nothing they don't.
# Survival curve (Kaplan-Meier), built with a groupby. t = df.groupby("months").agg(left=("churned", "sum"), ended=("churned", "size")).sort_index() t["at_risk"] = len(df) - t["ended"].cumsum().shift(fill_value=0) t["survival"] = (1 - t["left"] / t["at_risk"]).cumprod() curve = t["survival"].reindex(range(0, 73)).ffill().fillna(1.0) print("\nShare of clients still with you after:") for m in [3, 6, 12, 24, 36, 48, 60]: print(f" {m:>2} months: {curve[m]:.0%}") median = int((curve <= 0.5).idxmax()) print(f"\nMedian lifetime: {median} months") print(f"Average months per client over the first six years: {curve.iloc[:72].sum():.1f}") Share of clients still with you after: 3 months: 86% 6 months: 76% 12 months: 66% 24 months: 57% 36 months: 47% 48 months: 42% 60 months: 37% Median lifetime: 33 months Average months per client over the first six years: 37.4 Line by line:
-
leftis the number of clients who quit after exactly that many months.endedis everyone whose record stops there, quitters and active clients alike. -
at_riskis how many clients had lasted at least that long. It starts at 400 and falls as records end. -
1 - left / at_riskis the share who made it through that month.cumprod()chains them into a curve.
The median lifetime is 33 months. Half the clients are still there after two and three-quarter years. That's almost two and a half times what shortcut 1 said.
The average, counting only the first six years, is 37.4 months. And that's still an underestimate of the true average, because 37% of clients are still active at month 60 and their months beyond year six aren't counted. With six years of data, you can't know more than that. Say so when you report it.
Here's why this matters commercially. In this short video I walk through what churn does to what a client is worth: a client expected to stay ten years who really stays four is worth 40% of what you thought. The same is true in reverse. If you believe clients stay 13.5 months when they stay 33, you'll think you can't afford to win them.
Where are clients being lost?
A single lifetime figure hides the shape. The curve doesn't. It drops 24 points in the first six months, then only 10 points in the next six, and between 5 and 10 points a year after that.
# What changes if the first six months go as well as the later ones? print(f"\nSurvival at month 6: {curve[6]:.0%}") later = (curve[36] / curve[12]) ** (1 / 24) print(f"Monthly retention between months 12 and 36: {later:.1%}") print(f"Same rate over the first six months would give: {later ** 6:.0%}") Survival at month 6: 76% Monthly retention between months 12 and 36: 98.6% Same rate over the first six months would give: 92% Once a client is past the first year, the agency keeps 98.6% of them each month. If the first six months went that well, 92% of new clients would reach month six. The actual figure is 76%.
So the agency loses 24 of every 100 new clients in six months, when its own later retention suggests it should lose about 8. That's sixteen clients per hundred lost to something specific about the early period: onboarding, expectations set in the sales call, or the first invoice arriving before any value has.
That's a far more useful finding than "average lifetime is X." It tells the owner where to look.
Using it on real data
To run this on your own billing export:
- Build one row per client. First invoice month, last invoice month, and an active flag. Define "active" clearly, for example invoiced within the last two months.
- Compute
monthsas the number of months between first and last invoice, plus one. - Set
churnedtoTruewhere the client isn't active. - Run the groupby above. Nothing else changes.
Things to watch:
- Paused clients. Decide whether a three-month gap is a pause or a departure, and apply the rule consistently.
- Thin tails. Past the point where only a few dozen clients remain at risk, the curve gets jumpy. Don't read much into the far right.
- Changing behavior. This blends clients from six years ago with clients from last year. If onboarding changed, run the curve separately by signup year and compare.
- Different client types. Split by plan, size or lead source. Lifetimes often differ a lot between groups.
If you want confidence intervals or comparisons between groups, the lifelines library does it properly. But the ten lines above get you an honest number, and they make the logic visible to whoever has to trust the result.
FAQ
What is censored data?
Records where you know something lasted at least a certain time but not how long it lasts in total. Every active client is a censored record.
Why use the median and not the mean?
The median is known as soon as the curve crosses 50%. The mean needs the whole curve, including years you don't have data for yet.
How many clients do I need for this to work?
A few hundred gives a usable curve. With fewer than a hundred, treat it as a rough guide and avoid splitting into groups.
Can I use this for subscriptions as well as retainers?
Yes. Anything with a start, a possible end and a group that hasn't ended yet works the same way.
Further reading: retainer renewal cohort analysis and why the 3:1 lifetime value rule is wrong for service businesses.

