File size: 3,842 Bytes
74f458f
 
 
13f5ff8
 
 
 
 
 
 
 
9348411
 
483d241
9348411
3e6d95f
0273a51
483d241
74f458f
13f5ff8
74f458f
9efcc7e
 
74f458f
9efcc7e
74f458f
 
 
9efcc7e
 
 
74f458f
9efcc7e
 
 
 
 
74f458f
 
 
9efcc7e
 
74f458f
9efcc7e
 
 
 
 
 
 
74f458f
 
 
9efcc7e
 
74f458f
9efcc7e
 
74f458f
 
 
9efcc7e
 
74f458f
9efcc7e
f452209
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
---
license: mit
---

# 🏦 Bank Customer Churn Analysis

![Python](https://img.shields.io/badge/Python-3.8%2B-blue?style=for-the-badge&logo=python&logoColor=white)
![Pandas](https://img.shields.io/badge/Pandas-Data%20Analysis-150458?style=for-the-badge&logo=pandas&logoColor=white)
![Scikit-Learn](https://img.shields.io/badge/scikit--learn-Machine%20Learning-F7931E?style=for-the-badge&logo=scikit-learn&logoColor=white)
![Status](https://img.shields.io/badge/Status-Completed-success?style=for-the-badge)

## πŸŽ₯ Project Walkthrough (Video)

Click the image below to watch the full explanation of the data analysis:

[![Watch the Video](https://img.youtube.com/vi/Syatg5hxqLc/0.jpg)](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.

![Churn Rate by Geography](plot_geography_churn.png)

> **πŸ’‘ 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.

![Age Distribution by Churn Status](plot_age_density.png)

> **πŸ’‘ 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