Python EDA & RCA Β· 10,000 Customers & 3 Datasets (4,600+ Support Rows) Β· 27% Churn (~$73K MRR at Risk)
Stack: Python Β· Pandas Β· NumPy Β· Seaborn Β· Matplotlib Β· EDA Β· RCA Β· Jupyter Notebook
Investigated customer attrition patterns and recurring revenue impact across 10,000 customers by combining and cleaning 3 datasets containing 4,600+ (4,647) support records using Pandas for customer-level analysis:
- π Root Cause Analysis (RCA): Debunked false support-escalation hypotheses (
0.00correlation with support escalations) and isolated higher churn among month-to-month customers during their first 12 months, plus 2,727 High-Risk Score (70+) accounts. - π οΈ Python Relational & Cleaning Pipeline: Built a reproducible Pandas/NumPy ingestion and aggregation workflow that joins 3 normalized tables without row explosion (
10,000 Γ 26clean master schema) and segmentstenure_groupandchurn_risktiers. - π° Revenue Impact: Identified a 27% (27.27%) churn rate (2,727 customers) and approximately $73K ($73,267.54) in monthly revenue at risk, highlighting clear customer retention priorities for Month 1β12 onboarding.
| Metric Category | Key Performance Indicator (KPI) | Analytical Finding | Business Context & Strategic Impact |
|---|---|---|---|
| Cohort Scale | Total Customers | 10,000 accounts | Complete active & churned customer ledger |
| Attrition Volume | Total Churned Customers | 2,727 accounts | Customers with validated cancellation dates |
| Headline Rate | Overall Churn Rate | 27.27% | Base attrition rate across subscriber cohorts |
| Retention Stability | Overall Retention Rate | 72.73% | Healthy multi-year subscriber baseline |
| Revenue Baseline | Average Revenue Per User (ARPU) | $26.55 / month | Mean recurring subscription value per user |
| Financial Exposure | Monthly Revenue at Risk | $73,267.54 | Monthly charges tied directly to churned accounts |
| Support Friction | Customer Escalation Rate | 15.19% (1,519 users) | Accounts with at least one critical escalation |
| Support Density | Support Interaction Coverage | 3,800 customers (38%) | 4,647 logged tickets across multi-channel support |
| High Risk Tier | High-Risk Segment (Score 70+) | 2,727 accounts (27.3%) | Perfectly aligned outcome validation cohort |
| Statistical Signal | Churn / Support Escalation Correlation | 0.00 | Proves escalations are independent of churn |
Uniform churn distribution across tiers confirms that plan pricing is not an isolated driver of cancellations.

Short tenure groups show high churn due to historical cancellation boundaries.

Identical churn rates (27.4% vs 27.2%) demonstrate that customer support friction is not the core attrition catalyst.

Risk tier distribution across Low Risk (42.3%), Medium Risk (30.4%), and High Risk (27.3%).

Full correlation matrix between billing, tenure, complaints, CSAT scores, and churn flags.

The raw data originated from a 3-sheet normalized Excel workbook linked via customerid:
flowchart TD
subgraph DataSources
C["db_customer - 10,000 Accounts (Demographics & Geography)"]
S["db_subscription - 10,000 Accounts (Billing, Tenure & Churn Flag)"]
SP["db_support - 4,647 Logs (Complaints, CSAT & Escalations)"]
end
subgraph Pipeline
P["Python EDA & Feature Engineering Pipeline"]
R["Tenure Cohort & Risk Tier Segmentation"]
end
subgraph Output
K["Key Finding: 27.27% Overall Churn Rate"]
T["Tipping Point: Tenure < 12 Months"]
end
C -->|"customerid"| P
S -->|"customerid"| P
SP -->|"customerid (1:N)"| P
P --> R
R --> K
R --> T
Python Generator (Random Seed 42)
β
Multi-Sheet Excel Workbook (db_customer / db_subscription / db_support)
β
Pandas read_excel & Shape Validation (10K / 10K / 4.6K)
β
Data Cleaning & Normalization (Gender M/F, "Referral", Datetime Parsing, Imputation)
β
Feature Engineering (churn_flag, tenure_days, tenure_group, churn_risk)
β
Support Aggregation (Total Complaints, Escalations, CSAT to 1 row per customer)
β
Safe Relational Left-Joins on customerid
β
Master Customer Analytics Dataset (10,000 rows Γ 26 columns)
β
KPIs Β· Segment Breakdown Β· Support Friction Β· Heatmap Correlations
β
Executive Findings & Strategic Retention Recommendations
- Gender Harmonization: Standardized mixed labels (
Men,Women,Male,Female) into clean binary categories (Male: 5,226,Female: 4,774). - Missing Value Handling: Replaced missing countries (694 rows) and interests (3,371 rows) with explicit
"Unknown"categories to prevent dropping customer rows. Blank comments filled with"No comment". - String Correction: Corrected typographical errors in acquisition channel (
"Refferal"β"Referral"). - Column Pruning: Dropped completely empty structural fields (
pincode,col_1).
- Vectorized Churn Flag:
df_subscription_clean['churn_flag'] = np.where( df_subscription_clean['cancellation_date'].notnull(), 1, 0 )
- Tenure Calculation: Engineered tenure in elapsed days (cancellation date minus start date for churned users; analysis runtime date for active users), categorized into cohorts (
0-6 Months,6-12 Months,1-2 Years,2+ Years). - Support Aggregation (Preventing Row Explosion): Grouped multiple tickets per customer into clean summary metrics before joining:
df_support_agg = df_support_clean.groupby('customerid').agg( total_complaints=('customerid', 'count'), total_escalations=('escalations', lambda x: (x == 'Yes').sum()), avg_csat_score=('csat_score', 'mean'), last_complaint_date=('complaint_date', 'max') ).reset_index()
Observed churn rates are remarkably uniform across all customer segments:
- Plan Type: Premium (27.57%), Basic (27.43%), Standard (26.95%).
- Subscription Type: Organic (27.94%), Referral (27.80%), Paid (26.08%).
- Contract Type: Monthly (27.39%), Annual (27.17%).
Although Premium users churn at the same rate as Basic users (~27%), their average monthly charge is 5.6x higher ($56.61 vs. $10.04).
- 818 churned Premium customers account for ~$46,300/month, representing 63.2% of the total $73,267.54 revenue at risk.
- Customers with support escalations experienced a 27.39% churn rate, compared to 27.25% for non-escalated users.
- The correlation between complaints/escalations and churn is 0.00, indicating that customer service contact is not the root catalyst for cancellations in this dataset.
- Prioritize Premium Retention Workflows: Because 63% of lost revenue sits in the top tier, assign dedicated account managers and VIP onboarding to Premium subscribers.
- Standardize Tenure at Fixed Cohort Dates: Implement monthly acquisition cohort tracking rather than dynamic run-date tenure to avoid observational survivor bias.
- De-duplicate Customer Feedback Loops: Disconnect automated churn scoring from retroactive cancellation flags and build predictive forward-looking models.
customer-churn-analysis-python/
β
βββ Churn_Analysis.ipynb # Master analytical Jupyter Notebook with step-by-step code
βββ chur_Generator.py # Synthetic relational dataset generator script (Seed 42)
βββ Customer_Churn_Analysis.docx # In-depth 17-section project report & methodology documentation
βββ customer_churn_data.xlsx # Multi-table relational source dataset (10,000 records)
β
βββ data_architecture_pipeline.png # Python Diagnostic Pipeline & Feature Engineering Model
βββ churn_rate_by_plan_type.png # Viz 1: Churn rate by subscription plan
βββ churn_rate_by_tenure_group.png # Viz 2: Churn rate across customer tenure cohorts
βββ churn_rate_escalation_vs_no_escalation.png # Viz 3: Support escalation comparison
βββ customer_distribution_by_churn_risk.png # Viz 4: Customer risk tier pie distribution
βββ correlation_heatmap_key_metrics.png # Viz 5: Full seaborn statistical correlation matrix
β
βββ requirements.txt # Python library dependencies (Pandas, Seaborn, etc.)
βββ .gitignore # Ignores .ipynb_checkpoints, virtual environments, caches
βββ README.md # Master portfolio project pitch & business report
-
Clone the Repository:
git clone https://github.com/ravinder0710/customer-churn-analysis-python.git cd customer-churn-analysis-python -
Set up Virtual Environment & Install Dependencies:
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate pip install -r requirements.txt
-
Launch Jupyter Notebook:
jupyter notebook Churn_Analysis.ipynb
Ravinder Gupta
Independent Analytics Consultant | Data & BI Analyst
- π Location: Gurugram (Delhi-NCR), India
- π Portfolio: ravinder0710.github.io
- π§ Email: iamravindergupta17@gmail.com
- π GitHub: github.com/ravinder0710