Customer Analytics
Who are our best customers?.
Not all customers are equal. In almost every business, a small group delivers a large share of the value. Find them, keep them happy, and you've done more for the business than any fancy model could.

- Not all customers are equal
- A few deliver most of the value
- Find them and keep them
Value tiers
We estimate each customer's monthly value, as visits times spend, then split them into four equal tiers. Run it. Look at the share column. The top quarter of customers bring in about half of the money. And look at their churn. They're the least likely to leave. Even so, losing one customer from the top tier hurts far more than losing one from the bottom. So where should the loyalty budget go? Now you can answer.
import pandas as pd
df = pd.read_csv("customers.csv").drop_duplicates()
df["value"] = df["visits_per_month"] * df["avg_spend"]
df["tier"] = pd.qcut(df["value"], 4, labels=["Low", "Mid", "High", "Top"])
s = df.groupby("tier", observed=True).agg(customers=("value", "size"),
monthly=("value", "sum"), churn=("churned", "mean"))
s["share"] = (s["monthly"] / s["monthly"].sum()).round(3)
print(s.round(2).to_string())customers monthly churn share tier Low 1500 19486.23 0.38 0.06 Mid 1500 44509.27 0.33 0.15 High 1500 76442.46 0.24 0.25 Top 1500 161155.27 0.14 0.53
Cohort analysis
A cohort is a group that started at the same time. Comparing cohorts removes a lot of confusion. We compare churn by signup year, with and without a loyalty card. Run it. The card holders leave less in all three years, so this pattern isn't a one off. If a metric gets better overall, cohorts can tell you if that's a real improvement, or just a change in the customer mix.
import pandas as pd
df = pd.read_csv("customers.csv", parse_dates=["signup"]).drop_duplicates()
df["cohort"] = df["signup"].dt.year
table = df.groupby(["cohort", "loyalty"])["churned"].mean().unstack().round(3)
table.columns = ["No card", "Card"]
print(table.to_string())No card Card cohort 2023 0.323 0.195 2024 0.291 0.201 2025 0.315 0.212
What is a customer worth?
Customer lifetime value turns all of this into one number. Monthly profit, divided by churn. Run it. See how sensitive it is. Cutting churn from six percent to four raises each customer's value by half. So keeping customers is often worth more than winning new ones. Now the founder knows how much to spend on winning a customer.
monthly_value, margin, churn = 40.0, 0.68, 0.06
lifetime = 1 / churn
ltv = monthly_value * margin * lifetime
print(f"Expected lifetime: {lifetime:.1f} months")
print(f"Customer value: ${ltv:,.0f}")
for c in [0.06, 0.05, 0.04]:
print(f"Churn {c:.0%}: value ${monthly_value * margin / c:,.0f}")Expected lifetime: 16.7 months Customer value: $453 Churn 6%: value $453 Churn 5%: value $544 Churn 4%: value $680
Summary
Value tiers, cohorts, and lifetime value. These are the numbers that run real businesses. But we still can't answer the question that matters the most. Does the loyalty card actually cause people to stay? That's what's next.
Key takeaways- A few customers bring most value
- Cohorts remove confusion
- Small churn cuts mean big value