โ† Back to projects
๐Ÿฆ
Python ยท Machine Learning

Bank Customer Churn Analysis

End-to-end Python analysis identifying key factors driving customer churn โ€” from data cleaning through EDA to actionable business recommendations.

20.37% Overall Churn32.4% Germany Churn56.2% Age 51-60 Churn26.9% Inactive Member Churn
PythonPandasNumPyMatplotlibSeabornScikit-learn

Overview

End-to-end Python analysis identifying the key drivers of customer churn for a bank with 10,000 customers across France, Germany, and Spain. Covers the full data science workflow โ€” raw data ingestion, cleaning, EDA, and actionable business recommendations.

Dataset: 10,002 rows ร— 14 columns โ†’ cleaned to 10,000 rows ร— 11 features
Target variable: Exited (1 = churned, 0 = retained)

Objective

Identify the key factors driving customer churn and deliver data-backed recommendations to reduce attrition and improve retention strategy.

Phase 1 โ€” Data Understanding & Preparation

  • Initial Exploration โ€” loaded dataset, checked dimensions, reviewed data types and column structure
  • Quality Assessment โ€” found 2 duplicate rows, 4 columns with 1 missing value each, Age stored as float
  • Cleaning โ€” removed duplicates and 3 irrelevant columns (RowNumber, CustomerId, Surname); filled missing values with mode/median; corrected data types
  • Output โ€” clean dataset: 10,000 rows ร— 11 columns, zero missing values, CreditScore range 350โ€“850 valid โœ…

Phase 2 โ€” Exploratory Data Analysis (EDA)

Univariate Analysis

  • France: 50.14% of customers ยท Germany: 25.09% ยท Spain: 24.77%
  • Age distribution: 31โ€“40 is largest group (44.5%); 51โ€“60 is smallest active segment (8.0%)
  • 36.16% of customers have zero balance
  • Overall churn rate: 20.37% (2,037 of 10,000 customers)

Bivariate Analysis โ€” Churn by Geography

CountryCustomersChurn Rate
France5,01416.15%
Germany2,50932.44%
Spain2,47716.67%

Germany churns at double the rate of France and Spain despite fewer customers.

Bivariate Analysis โ€” Churn by Age Group

Age GroupChurn Rate
18โ€“307.52%
31โ€“4012.08%
41โ€“5033.97%
51โ€“6056.21%
60+24.78%

Bivariate Analysis โ€” Other Features

  • Female churn: 25.1% vs male: 16.5% โ€” 8.6pp gap
  • Inactive members churn at 26.9% vs active members โ€” engagement directly reduces attrition
  • 1-product customers: 50.84% of base, highest churn; 2-product: lowest churn; 3โ€“4 products: disproportionately high churn despite only 3.26% of base
  • Churned customers average age 44.84 vs 37.41 retained โ€” age is the strongest predictor
  • CreditScore difference: only 6.5 points between churned and retained โ€” weak predictor

Correlation Analysis

  • Age: strongest positive correlation with churn
  • IsActiveMember: negative correlation โ€” inactive = higher churn
  • CreditScore & EstimatedSalary: minimal correlation with churn

Key Findings

  • Germany is a critical risk market โ€” 32.44% churn vs ~16% in France and Spain
  • Middle-to-older customers (41โ€“60) are the highest risk โ€” 51โ€“60 age band peaks at 56.21%
  • Female customers churn at 25.1% vs 16.5% for males โ€” 8.6 percentage point gap
  • Inactive members churn at 26.9% โ€” engagement directly reduces attrition
  • Customers with 3โ€“4 products have extremely high churn despite being a small segment (3.26%)
  • CreditScore is a weak predictor โ€” only 6.5 point difference between churned and retained

Business Recommendations

  • Targeted retention campaigns in Germany with localised, personalised offers
  • Age-segmented loyalty programmes for customers aged 41โ€“60
  • Re-engagement campaigns for inactive members (26.9% churn risk)
  • Gender-specific engagement strategies for female customers
  • Cross-sell products to single-product customers to increase stickiness
  • Review product bundling strategy โ€” 3โ€“4 product customers show disproportionate churn