Skip to content

Vishxnu/Employee-Attrition-Analysis

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

๐Ÿš€ Employee Attrition Analysis using Python ๐Ÿง 

Python Animation

๐Ÿ“Š A Data Analytics Reinforcement Project by Vishnu Raj


๐ŸŒŸ Project Overview

Employee attrition (or employee turnover) is a major concern for organizations today.
The goal of this project is to analyze employee data and understand the factors that influence attrition, helping HR teams to make smarter, data-driven retention decisions.

This analysis focuses on Exploratory Data Analysis (EDA) and Statistical Testing using a synthetic dataset, simulating real-world HR conditions.


๐ŸŽฏ Project Objectives

โœ… Identify which factors are strongly linked to employee attrition
โœ… Explore demographic, job, and performance data for patterns
โœ… Apply statistical tests to check significant relationships
โœ… Visualize data clearly for better storytelling and HR insights


โš™๏ธ Tools and Libraries Used

Purpose Library
Data Handling pandas, numpy
Visualization matplotlib, seaborn
Statistical Testing scipy.stats
Development Jupyter Notebook
Version Control Git & GitHub

๐Ÿ“ About the Dataset

๐Ÿ“„ Dataset Name: Employee Attrition.csv
๐Ÿ“Š Records: 59,598
๐Ÿงฉ Columns: 24 (Age, Income, Role, Satisfaction, etc.)
๐Ÿง  Target Variable: Attrition (Stayed / Left)

The dataset is synthetic, meaning itโ€™s computer-generated to simulate real HR data.
This helps us analyze real-world-like scenarios without privacy concerns while keeping the logic and variability realistic.


๐Ÿงน Data Preprocessing Steps

โœ” Checked duplicates and verified no missing values
โœ” Converted categorical columns to numerical for correlation and analysis
โœ” Applied IQR method to detect and remove outliers from Monthly Income and Years at Company
โœ” Cleaned and structured data for EDA and statistical testing

Data Cleaning Animation


๐Ÿ“Š Exploratory Data Analysis (EDA)

๐Ÿ”น Univariate & Bivariate Analysis

Analyzed relationships between attrition and key variables such as:

  • Gender
  • Job Role
  • Work-Life Balance
  • Monthly Income
  • Years at Company

๐Ÿงฉ Example:
Employees with poorer work-life balance and fewer promotions were more likely to leave, while income had minimal effect.

Graph Animation


๐Ÿงฎ Statistical Analysis

Test Comparison Purpose Result
Chi-Square Test Gender vs Attrition Check if gender influences attrition โœ… Significant association
Independent t-test Monthly Income vs Attrition Check if salary differs between groups โŒ No significant difference
Independent t-test Promotions vs Attrition Check if promotions affect attrition โœ… Significant difference
Independent t-test Distance vs Attrition Check if commute distance affects attrition โœ… Significant difference

๐Ÿ” Example Result

The t-test for promotions showed a significant difference (p < 0.05),
meaning employees who received fewer promotions were more likely to leave.

Statistical Test Animation


๐Ÿง  Key Insights & Findings

๐Ÿ’ก Employees who left the company were:

  • Slightly younger (avg. 37.9 yrs vs 39.1 yrs)
  • Had fewer promotions and longer commutes
  • Had similar salaries to those who stayed

๐Ÿ“ˆ Conclusion:
Attrition is not primarily salary-driven โ€” itโ€™s more influenced by career growth, commute distance, and work-life balance.


๐Ÿ“ˆ Correlation Heatmap

Heatmap Animation

Key Observations:

  • Work-Life Balance has a moderate positive correlation with Attrition
  • Job Level and Distance from Home show visible differences between groups
  • Most other factors show weak correlation โ€” confirming attrition is multi-factorial

๐Ÿ“Š Outlier Detection (IQR Method)

Outliers were identified using the Interquartile Range (IQR) formula:

Removed extreme values in:

  • Monthly Income
  • Years at Company

This improved the reliability of further analysis and visualizations.

Boxplot Animation



๐Ÿ Conclusion

This project highlights how data analysis and hypothesis testing can uncover meaningful trends behind employee behavior.
By studying career growth, work-life balance, and commute distance, HR teams can focus on improving these areas to reduce attrition rates effectively.

Conclusion Animation


๐Ÿ™Œ Author

๐Ÿ‘จโ€๐Ÿ’ป Vishnu Raj
๐ŸŽ“ Data Analytics Reinforcement Project
๐Ÿ’ผ GitHub | LinkedIn | ๐Ÿ“ง vishnuskillx@gmail.com

Thank You GIF


โญ If you found this project interesting, please give it a star! โญ

About

A detailed data analysis project on employee attrition using Python, Pandas, and statistical tests.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors