This project has two parts. First, a descriptive analysis of the revenue customers have already generated historically. Second, a simple predictive projection of what each customer segment is expected to be worth going forward, using a standard formula-based approach (not machine learning).
For a subscription-based service, what is each customer segment actually worth over their lifetime — both historically (revenue already earned) and going forward (projected future value, given how likely that segment is to churn)? Which segments should retention investment prioritize, based on where the most future value is at risk?
A segment might look valuable based on historical revenue alone, but if that segment also churns quickly, its true future value could be much lower than it appears — or vice versa. Combining historical and projected value gives a more complete, decision-ready picture than either view alone.
| Contract Type | Avg Historical CLV | Avg Monthly Revenue |
|---|---|---|
| Month-to-month | $1,369.25 | $66.40 |
| One year | $3,032.62 | $65.05 |
| Two year | $3,706.93 | $60.77 |
Month-to-month customers pay the highest average monthly rate, while Two-year customers pay the lowest — yet Two-year customers accumulate far more total value simply by staying longer. Viewed by monthly rate alone, Month-to-month looks more valuable; viewed by total historical revenue, it looks least valuable. Neither view alone tells the full story.
Projecting forward using Average Monthly Revenue ÷ Monthly Churn Rate
tells a very different story:
| Contract Type | Monthly Churn Rate | Predicted CLV |
|---|---|---|
| Month-to-month | 42.71% | $155.47 |
| One year | 11.27% | $577.20 |
| Two year | 2.83% | $2,147.35 |
Predicted CLV for Month-to-month customers is roughly 13x lower than their historical average. This gap is explained by survivorship bias: historical averages only reflect customers who already stayed long enough to be counted, while predicted CLV reflects the true expected value of a typical new customer, given how quickly that segment actually churns.
A one-way ANOVA confirmed average CLV differs significantly across contract types (F = 920.33, p < 0.0001) — not a chance pattern in this sample.
- Do not use historical CLV alone to judge segment value. It overstates the true expected worth of high-churn segments. Predicted CLV should be the primary metric for forward-looking decisions like acquisition spend or retention budget allocation.
- Month-to-month customers generate the highest revenue per month but the lowest lifetime value. They are poor long-term retention targets unless that investment specifically reduces their churn rate — resources are likely better spent converting them to longer contracts.
- Two-year contract customers are dramatically more valuable when projected forward. Prioritizing contract conversion is likely the single highest-leverage lever for increasing overall customer value.
- The predictive CLV formula assumes each segment's current churn rate stays constant going forward — a simplification. Real churn rates can shift due to market conditions, competitor actions, or product changes.
Churnis treated as representing monthly churn — an assumption appropriate for this dataset's structure, but worth stating explicitly since it directly drives the predictive calculation.- This analysis does not account for acquisition cost — high predicted CLV alone doesn't justify pursuing a segment if the cost to acquire those customers is also disproportionately high.
IBM Telco Customer Churn (public dataset via Kaggle). 7,043 customers, one row each, including tenure, contract type, monthly/total charges, and churn status.
- Extraction (
src/etl.py) — raw CSV loaded into DuckDB; relevant columns extracted via SQL. - Cleaning (
src/etl.py) — numeric columns converted from text; a small number of blankTotalChargesvalues (brand-new customers) filled with 0. - Bucketing (
src/etl.py) — customers grouped into 5 tenure ranges usingpd.cut(). - Descriptive CLV (
src/analysis.py) — average historical revenue and monthly rate calculated per segment. - Predictive CLV (
src/analysis.py) — projected future value calculated per segment usingAverage Monthly Revenue ÷ Monthly Churn Rate. - Statistical testing (
src/analysis.py) — one-way ANOVA confirming CLV differences across contract types are statistically significant. - Compare descriptive vs. predictive CLV to identify segments that are over- or under-valued when future risk is accounted for.
- Run a statistical test (ANOVA) to confirm whether CLV genuinely differs across contract types.
- Provide business recommendations combining both views.
customer-lifetime-value-analysis/ ├── data/ │ └── raw/ │ └── telco_churn.csv ├── notebooks/ │ └── 01_clv_analysis.ipynb # full narrated walkthrough ├── src/ │ ├── etl.py # load, clean, bucket │ └── analysis.py # descriptive/predictive CLV, charts, ANOVA └── outputs/ └── figures/ ├── clv_by_contract.png ├── clv_by_tenure.png └── clv_historical_vs_predicted.png
# 1. Set up environment
python -m venv venv
source venv/Scripts/activate # Windows Git Bash
pip install -r requirements.txt
# 2. Load, clean, and bucket the data
python src/etl.py
# 3. Run the full CLV analysis (descriptive, predictive, statistical test)
python src/analysis.pyAlternatively, open notebooks/01_clv_analysis.ipynb for a narrated,
cell-by-cell walkthrough with inline charts and explanations.
Python, pandas, DuckDB, SQL, Matplotlib, Seaborn, SciPy
