Skip to content

wareefAlyousef/Employee-Attrition-STC

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Employee Attrition Dashboard

License: MIT Python Dash Plotly Pandas NumPy SQLite scikit-learn statsmodels Jupyter

Analyzing employee data to uncover key factors influencing attrition, providing insights for HR strategies.

Table of Contents

Visual Demo

Employee Attrition Dashboard

Demo 1

Employee Management page

Demo 2

Overview

The Employee Attrition Dashboard is an interactive web application built with Dash and Plotly that provides comprehensive insights into employee attrition patterns within an organization. This dashboard enables HR professionals and managers to:

  • Visualize attrition rates across different departments, job roles, and demographics
  • Identify key factors influencing employee turnover
  • Manage employee data through an intuitive interface

The application connects to an SQLite database containing employee information and provides both analytical visualizations and data management capabilities.

Data Source & Dictionary

Data Source
This project uses the IBM HR Analytics Employee Attrition & Performance dataset, available on Kaggle.
The dataset contains detailed employee-level information such as demographics, job role, performance, and attrition status.

Data Dictionary (Key Columns)

  • Attrition: Whether an employee left the company (Yes/No).
  • Age: Age of the employee.
  • BusinessTravel: Frequency of business travel (Non-Travel, Travel_Rarely, Travel_Frequently).
  • Department: Department the employee belongs to (Sales, Research & Development, Human Resources).
  • EducationField: Field of study of the employee (Life Sciences, Medical, Marketing, Technical Degree, etc.).
  • Gender: Gender of the employee.
  • JobRole: Job title/position of the employee.
  • MaritalStatus: Marital status (Single, Married, Divorced).
  • MonthlyIncome: Monthly salary.
  • NumCompaniesWorked: Number of companies the employee has worked at before.
  • OverTime: Whether the employee works overtime (Yes/No).
  • PerformanceRating: Performance rating score.
  • TotalWorkingYears: Total years of professional experience.
  • YearsAtCompany: Number of years the employee has been at the company.
  • YearsInCurrentRole: Number of years the employee has been in the current role.
  • YearsSinceLastPromotion: Years since the employee’s last promotion.
  • YearsWithCurrManager: Number of years the employee has been with their current manager.

Features

  • Interactive Visualizations: Bar charts, violin plots, and heatmaps showing attrition patterns
  • Department Filtering: Analyze attrition by specific departments
  • Employee Management: Add new employees and update existing records
  • Responsive Design: Clean, modern UI with custom styling

Technologies Used

  • Backend: Python 3.10 Python
  • Web Framework: Dash Dash
  • Visualization: Plotly Plotly
  • Data Processing: Pandas Pandas, NumPy NumPy
  • Database: SQLite SQLite
  • Statistical Analysis: scikit-learn scikit-learn, statsmodels statsmodels

Required Libraries

To run this project, you need to install the following Python packages:

pip install dash
pip install plotly
pip install pandas
pip install numpy
pip install scikit-learn
pip install statsmodels

Database Schema

The application expects an SQLite database (employee_database.db) with the following tables:

  • Employees (EmployeeID, DepartmentID, JobID, MonthlyIncome, OverTime, Attrition, etc.)
  • Departments (DepartmentID, DepartmentName)
  • Jobs (JobID, JobRole, JobLevel)
  • EducationFields (EducationFieldID, FieldName)

ER Diagram

How to Run

  1. Clone the repository:
git clone <repository-url>
cd <repository-directory>
  1. Install required dependencies:
pip install -r requirements.txt
  1. Run the application:
python app.py
  1. Access the dashboard: Open your web browser and navigate to http://127.0.0.1:8050/

Key Insights

Based on the analysis performed:

  1. Primary Factors Influencing Attrition:

    • Job Role (Sales Representatives have 40% attrition rate)
    • Overtime (Employees working overtime have 31% attrition rate)
    • Marital Status (Single employees have 26% attrition rate)
    • Business Travel (Frequent travelers have 25% attrition rate)
  2. Secondary Influencing Factors:

    • Education Field (Human Resources employees have 26% attrition rate)
    • Job Level (Lower levels correlate with higher attrition)
    • Monthly Income (Lower income correlates with higher attrition)
    • Tenure-related metrics (Less experience correlates with higher attrition)
  3. Weaker Correlations:

    • Job Satisfaction & Environment Satisfaction
    • Daily Rate & Hourly Rate
  4. Minimal to NO Impact Factors:

    • Salary Hike
    • Stock Option Level
    • Training Times Last Year
    • Relationship Satisfaction

Project Structure

├── app.py                 # Main Dash application
├── data/
│   │── WA_Fn-UseC_-HR-Employee-Attrition.csv   # Original data
│   └── cleanData.csv  
├── db/
│   │── employee_database.db  # SQLite database file
│   └── ERdiagram.png  # Er diagram image
├── notebooks/
│   └── Employee Attrition notebook.ipynb # Notebook
├── demo/
│   │── Dashboard.gif  
│   └── EmployeeManagement.gif
├── requirements.txt
├── LICENSE
├── .gitignore
└── README.md             # Project documentation

Results

The dashboard provides actionable insights into employee attrition patterns, helping organizations:

  • Identify high-risk departments and job roles
  • Monitor the effectiveness of HR initiatives
  • Make data-driven decisions about workforce management

Author & Acknowledgments

Author:

  • Waref Alyousef

Acknowledgments:

This project uses the IBM HR Analytics Employee Attrition & Performance dataset, made available on Kaggle by Pavan Subhash T

I gratefully acknowledge the dataset provider for making this data accessible for analysis and learning.

License

License: MIT This project is licensed under the MIT License - see the LICENSE file for details.

About

An HR analytics project exploring employee attrition using Python, data analysis, and a Dash dashboard.

Topics

Resources

License

Stars

Watchers

Forks

Contributors