Analysed by evanalytics
This project simulates how a Financial Analyst can leverage HR attrition data to support forecasting, cost modeling, and retention strategy — all essential to modern FP&A functions.
To explore how data-driven HR insights can inform financial decisions, we:
- Model the cost of employee attrition
- Detect potential retention bottlenecks
- Simulate real-world FP&A use cases
- Low income, frequent overtime, and low satisfaction are predictors of attrition.
- Departments with high attrition also show high variance in tenure and performance.
- Younger employees tend to leave earlier, reducing ROI on onboarding.
Category | Tools |
---|---|
Analysis | Python (Pandas, Seaborn, Matplotlib, Plotly) |
Interface | Jupyter Notebook |
Automation | Scripts & GitHub |
IDE | VS Code with Git Bash |
Visualization | Tableau / Power BI (optional) |
HR_analytics_evCorp/
.
├── data
│ └── WA_Fn-UseC_-HR-Employee-Attrition.csv
├── kaggle.json
├── notebooks
│ ├── correlation_heatmap.ipynb
│ ├── explore_dataset.ipynb
│ ├── explore_dataset2.ipynb
│ └── plot_attrition_cost.ipynb
├── outputs
│ ├── attrition_cost_by_department.csv
│ ├── attrition_leavers.csv
│ ├── correlation_heatmap.png
│ ├── percentages_attrition_rate_by_department.png
│ ├── plot_attrition_cost.png
│ ├── plot_Number_of_Employees_Who_Left.png
│ └── share_of_total_attrition_by_department.png
├── README.md
├── requirements.txt
├── scripts
│ ├── analyze_hr_data.py
│ ├── load_kaggle_data.py
│ └── model_attrition_cost.py
├── structure.txt
├── venv
│ ├── bin
│ ├── etc
│ ├── include
│ ├── lib
│ ├── pyvenv.cfg
│ └── share
└── venv310
├── etc
├── Lib
├── pyvenv.cfg
├── Scripts
└── share
16 directories, 21 files
The script scripts/model_attrition_cost.py
loads the dataset and calculates financial impact using the following steps:
-
Loads data from
/data/WA_Fn-UseC_-HR-Employee-Attrition.csv
-
Flags records where
Attrition == 'Yes'
-
Assigns a fixed cost of $50,000 per leaver (editable in script)
-
Computes:
- 🔻 Total number of leavers
- 💸 Total estimated cost of attrition
- 🏢 Department-wise cost breakdown
-
Saves results to
/outputs
folder as CSV files -
Plots a horizontal bar chart showing departmental attrition cost
File | Description |
---|---|
outputs/attrition_leavers.csv |
Records of employees who left |
outputs/attrition_cost_by_department.csv |
Cost breakdown per department |
This chart shows the attrition rate grouped by employee job satisfaction.
- Low satisfaction = highest attrition
- Very High satisfaction = lowest attrition
- The trend is clear and visual: satisfied employees stay longer
Departments with higher headcount loss represent greater risk in operational continuity and increased hiring/training costs.
Some job roles — especially client-facing or high-stress roles — exhibit notably higher attrition rates. This helps target role-specific retention programs.
- Correlation heatmaps revealed patterns in satisfaction, income, and overtime
- Attrition rates were highest in Sales and R&D
- Simulated savings by improving retention in high-cost departments
Explanation of Correlation Heatmap
This is a correlation matrix heatmap, where:
-
Each square represents the correlation between two variables.
-
Values range from:
+1.00
: Perfect positive correlation (when one goes up, so does the other)0.00
: No correlation-1.00
: Perfect negative correlation (when one goes up, the other goes down)
-
Colors:
- 🔴 Redder = stronger correlation (positive or negative)
- 🔵 Bluer = weaker or no correlation
You want to understand what variables are related to employee attrition — so let's read across the Attrition
row:
Variable | Correlation | Meaning |
---|---|---|
OverTime |
+0.25 | Strongest positive — more overtime → higher chance of attrition ✅ |
MonthlyIncome |
-0.16 | Negative — lower income → higher chance of leaving |
JobLevel |
-0.17 | Lower job level → more likely to leave |
TotalWorkingYears |
-0.17 | Fewer working years → more likely to leave |
Age |
-0.16 | Younger employees are more likely to leave |
YearsAtCompany |
-0.13 | Less time at company → higher attrition risk |
Everything else is near 0.00, so weak or no relationship.
- Correlation =
+0.25
- Suggests employees working overtime are more likely to quit (burnout risk)
-
All have negative correlations with attrition
-
Suggests people leave when they:
- Feel underpaid
- Are in junior roles
- Are early in their career
YearsAtCompany
,TotalWorkingYears
: negative correlation- Less experience → more likely to leave (possibly due to unmet expectations or lack of fit)
- These are correlations, not causation.
- Just because
OverTime
is positively correlated withAttrition
doesn’t prove it causes attrition, but it's a strong signal.
- Helps HR & Finance align on cost-saving goals
- Aids in budgeting and strategic workforce planning
- Demonstrates how analytics supports cost control