|
|
--- |
|
|
license: mit |
|
|
--- |
|
|
|
|
|
# π¦ Bank Customer Churn Analysis |
|
|
|
|
|
 |
|
|
 |
|
|
 |
|
|
 |
|
|
|
|
|
## π₯ Project Walkthrough (Video) |
|
|
|
|
|
Click the image below to watch the full explanation of the data analysis: |
|
|
|
|
|
[](https://www.youtube.com/watch?v=Syatg5hxqLc) |
|
|
|
|
|
> **In this video:** I explain the data cleaning process, outlier handling, and the key insights about customer churn. |
|
|
|
|
|
--- |
|
|
|
|
|
## π Project Overview |
|
|
This project is an **end-to-end data science analysis** of a bank customer dataset. The primary objective is to investigate the factors contributing to customer attrition (churn) and to identify patterns that distinguish customers who leave from those who stay. |
|
|
|
|
|
> **Context:** This work was completed as **Assignment 1** for the "Introduction to Data Science" course. |
|
|
|
|
|
--- |
|
|
|
|
|
## π 1. The Dataset |
|
|
**Dataset:** Bank Customer Churn (Kaggle) |
|
|
**Target Variable:** `Exited` (1 = Churned, 0 = Stayed) |
|
|
|
|
|
| Metric | Details | |
|
|
| :--- | :--- | |
|
|
| **Source** | `Churn_Modelling.csv` | |
|
|
| **Size** | 10,000 Rows | |
|
|
| **Key Features** | `CreditScore`, `Geography`, `Gender`, `Age`, `Tenure`, `Balance`, `NumOfProducts`, `EstimatedSalary` | |
|
|
|
|
|
--- |
|
|
|
|
|
## π§Ή 2. Data Cleaning & Preprocessing |
|
|
A rigorous cleaning process was applied to ensure data quality. Below are the **critical decisions** made during this phase: |
|
|
|
|
|
* **β Dropping Irrelevants:** Columns `RowNumber`, `CustomerId`, and `Surname` were removed as they are unique identifiers with no predictive power. |
|
|
* **β
Missing Values:** Confirmed 0 null values in the dataset. |
|
|
* **β
Duplicates:** Confirmed 0 duplicate rows. |
|
|
* **β οΈ Outlier Strategy:** |
|
|
* **Decision:** Outliers were **KEPT**. |
|
|
* **Justification:** In churn analysis, extreme values (e.g., older age, high balance) are often the most informative. Removing a 90-year-old customer would result in losing valid behavioral data for that demographic. |
|
|
* **βοΈ Feature Scaling:** Identified significant scale differences (e.g., `Balance` vs. `Age`). Applied `StandardScaler` to normalize features for model performance. |
|
|
|
|
|
--- |
|
|
|
|
|
## π 3. Exploratory Data Analysis (EDA) |
|
|
We focused on two main research questions to derive business insights. |
|
|
|
|
|
### π Q1: Does geography impact the churn rate? |
|
|
*Investigation:* Analyzing the proportion of churned customers across France, Germany, and Spain. |
|
|
|
|
|
 |
|
|
|
|
|
> **π‘ Insight:** |
|
|
> Geography is a strong predictor. While France has the highest volume of customers, **Germany exhibits a significantly higher churn rate**. This suggests potential issues with local competition, customer service, or market fit specifically in the German region. |
|
|
|
|
|
### π΄ Q2: What is the relationship between Age and Churn? |
|
|
*Investigation:* Using Kernel Density Estimation (KDE) to compare age distributions of retained vs. churned customers. |
|
|
|
|
|
 |
|
|
|
|
|
> **π‘ Insight:** |
|
|
> Age is a critical factor. |
|
|
> * **Stayed (0):** Peak distribution around **30-40 years old**. |
|
|
> * **Churned (1):** Distinct peak around **45-55 years old**. |
|
|
> * **Action Item:** The bank is losing its mature, middle-aged customer base. Retention campaigns should specifically target the 45-60 age demographic. |
|
|
|
|
|
--- |
|
|
|
|
|
## π οΈ Tech Stack |
|
|
* **Language:** Python |
|
|
* **Libraries:** Pandas, Matplotlib, Seaborn, Scikit-learn |
|
|
* **Environment:** Jupyter Notebook |