End-to-end HR Analytics on 2 million employee records | Analyzing workforce distribution, attrition, salary trends, performance & hiring patterns using Python, Pandas & Seaborn
An end-to-end HR Analytics project on 2,000,000 employee records, completed as part of the Python for Data Analysis course.
Analyze workforce distribution, attrition rates, salary trends, performance ratings, hiring patterns, and Remote vs On-site comparisons for a global MNC.
- Source: HRData.csv
- Records: 2,000,000 employees
- Departments: IT, Marketing, HR, Operations, Finance, Sales, R&D
- Features: Employee_ID, Full_Name, Department, Job_Title, Hire_Date, Location, Performance_Rating, Experience_Years, Status, Work_Mode, Salary_INR
⚠️ Dataset not included due to file size (>25MB).
| Library | Purpose |
|---|---|
| Pandas | Data cleaning, groupby, pivot_table, apply |
| Matplotlib | Bar charts, line charts, scatter plots |
| Seaborn | Heatmaps, boxplots |
| Technique | Purpose |
|---|---|
groupby().apply(nlargest) |
Top-N records per group (Q14) |
pivot_table() |
Cross-tabulation: Dept × Job Title (Q6) |
str.split().str[-1] |
Extract country from Location string |
resample() / dt.year |
Time-based hire trend analysis |
| Attrition Rate formula | Resigned / Total per Dept × 100 |
| # | Question |
|---|---|
| Q1 | Distribution of Employee Status |
| Q2 | Distribution of Work Modes |
| Q3 | Employee count per Department |
| Q4 | Average salary by Department |
| Q5 | Job title with highest average salary |
| Q6 | Average salary by Department × Job Title (heatmap) |
| Q7 | Resigned & Terminated count per Department |
| Q8 | Salary variation with Years of Experience |
| Q9 | Average performance rating by Department |
| Q10 | Countries with highest employee concentration |
| Q11 | Correlation between Performance Rating & Salary |
| Q12 | Number of hires per year (trend) |
| Q13 | Remote vs On-site salary comparison |
| Q14 | Top 10 highest-paid employees per Department |
| Q15 | Departments with highest attrition rate |
- Imports & Setup
- Load Dataset
- First Look
- Data Structure & Info
- Data Cleaning & Feature Engineering
- Analytical Questions (Q1 → Q15)
- Key Insights
- Active employees form the majority, but attrition is significant across departments
- R&D and Finance command the highest average salaries
- Salary grows with experience but plateaus after 12+ years
- Performance rating has weak positive correlation with salary
- Remote and On-site salaries are nearly identical — pay equity maintained
- Hiring accelerated significantly from 2018 onwards
git clone https://github.com/ammarelsayed-2a/Project-15-Python-For-Data-Analysis-HR.git
cd Project-15-Python-For-Data-Analysis-HR
jupyter notebook "Project 15 HR.ipynb"Ammar Elsayed — Python for Data Analysis | 2026
LinkedIn