From 9d942d36010ef2ff0eaa6f2b73a269aabd3c36bb Mon Sep 17 00:00:00 2001 From: HazelJJJ <65373316+HazelJJJ@users.noreply.github.com> Date: Sat, 23 Jan 2021 14:35:41 -0800 Subject: [PATCH 1/3] update readme --- README.md | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/README.md b/README.md index d508578..6b9b4f6 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,26 @@ ## Link to the deployed dashboard +## Welcome! +Welcome to our dashboard! + +Thank you for visiting the Attrtion app project repository. + +This document(the README file) is going to offer you some information about the project. We are very excited to show you what we have here! + +## What are we doing? + +### The problem + +Companies usually spend a large amount of money on training new employees every year. Whenever there is a turnover, it is costly to go through the hiring and training process. Therefore, employee loyalty is one the important things that management team should draw attention to. It is very useful to uncover the factors contribute to employee attrition. + +### The solution + +To address this challenge, we propose building a data visualization app that offers the management team to visually explore the dataset of employee attrition to identify common factors. Our app will show whether the employee choose to attrite and allow users to filter different variables in order to better explore and compare the factors that lead to attrition. + +## Motivation + +We designed this app based on the IBM HR Analytics Employee Attrition & Performance. Our target audience is the IBM Management Team. By navigating through the dashboard, it can help the management team observe the key contributors for attrition with guidance of a direction to improve employee retention and prevent attrition in the future. ## Description of app & sketch From c4f3fac165024129f5bc30a8af96183dfd673c70 Mon Sep 17 00:00:00 2001 From: Hazel Jiang Date: Sat, 23 Jan 2021 14:37:37 -0800 Subject: [PATCH 2/3] change location of app.py --- app.py => src/app.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename app.py => src/app.py (100%) diff --git a/app.py b/src/app.py similarity index 100% rename from app.py rename to src/app.py From f222bc42890096d883b934387df12a5b3608ad7e Mon Sep 17 00:00:00 2001 From: Hazel Jiang Date: Sat, 23 Jan 2021 14:40:54 -0800 Subject: [PATCH 3/3] use updated app.py --- src/app.py | 27 ++++++++------------------- 1 file changed, 8 insertions(+), 19 deletions(-) diff --git a/src/app.py b/src/app.py index 277da2c..199aefd 100644 --- a/src/app.py +++ b/src/app.py @@ -6,15 +6,14 @@ import pandas as pd import dash_bootstrap_components as dbc -#updated data path + df = pd.read_csv(r"data/Processed/HR_employee_Attrition_editted.csv") ###Convert variables to categoriccal and reordering by label. -df['EnvironmentSatisfaction'] = df['EnvironmentSatisfaction'].astype('category').cat.rename_categories(["Bad", "Good", "Better", "Best"]) -df['WorkLifeBalance']=df['WorkLifeBalance'].astype('category').cat.rename_categories(["Low", "Medium", "High", "Very High"]) +df['EnvironmentSatisfaction'] = df['EnvironmentSatisfaction'].astype('category').cat.rename_categories(["1 - Bad", "2 - Good", "3 - Better", "4 - Best"]) +df['WorkLifeBalance']=df['WorkLifeBalance'].astype('category').cat.rename_categories(["1 - Low", "2 - Medium", "3 - High", "4 - Very High"]) df["Department"]=df["Department"].astype('category') df["BusinessTravel"]=df["BusinessTravel"].astype('category') -df['BusinessTravel'] = df['BusinessTravel'].cat.rename_categories(["No Travel", "Travel Frequently", "Travel Rarely"]) -#df['BusinessTravel'] = df['BusinessTravel'].cat.reorder_categories(["Travel Rarely", "Travel Frequently", "No Travel"], ordered=True) +df['BusinessTravel'] = df['BusinessTravel'].cat.rename_categories(["1 - No Travel", "3 - Travel Frequently", "2 - Travel Rarely"]) # Setup app and layout/frontend app = dash.Dash(external_stylesheets=[dbc.themes.BOOTSTRAP]) @@ -30,14 +29,6 @@ options=[ {'label': col, 'value': col} for col in list(set(df.Department.tolist()))], placeholder='Select a department'), - - # 'Job Role', - # dcc.Dropdown( - # id='job-widget', - # value='Sales Representative', - # options=[ - # {'label': col, 'value': col} for col in set(df.JobRole.tolist())], - # placeholder='Select a job role'), 'Gender', dcc.Dropdown( @@ -65,13 +56,11 @@ id='scatter', style={'border-width': '0', 'width': '200%', 'height': '800px'}), )])]) - #style={"height": "1000vh"} # Set up callbacks/backend @app.callback( Output('scatter', 'srcDoc'), Input('depart-widget', 'value'), - #Input('job-widget', 'value'), Input('gender-widget', 'value'), Input('age_slider', 'value')) @@ -87,7 +76,7 @@ def plot_altair(depart,gender, age=18): chart_worklife = alt.Chart( df[(df['Department']==depart) &(df['Gender']==gender)&(df['Age']>=age[0])&(df['Age']<=age[1])], title='Work Life Balance').mark_bar().encode( - y=alt.Y('WorkLifeBalance:O', title='', scale=alt.Scale(domain=["Low", "Medium", "High", "Very High"])), + y=alt.Y('WorkLifeBalance:O', title=''), #scale=alt.Scale(domain=["Low", "Medium", "High", "Very High"]) x=alt.X('count()', stack = 'normalize', axis=alt.Axis(format='%'), title = 'Proportion'), color = 'Attrition' ).properties(height=200, width=250) @@ -95,14 +84,14 @@ def plot_altair(depart,gender, age=18): chart_travel = alt.Chart( df[(df['Department']==depart) &(df['Gender']==gender)&(df['Age']>=age[0])&(df['Age']<=age[1])], title='Business Travel Frequency').mark_bar().encode( - y=alt.Y("BusinessTravel", title="", scale=alt.Scale(domain=["No Travel", "Travel Rarely", "Travel Frequently"]), + y=alt.Y("BusinessTravel", title=""), x=alt.X('count()', stack="normalize", axis=alt.Axis(format='%'), title='Proportion'), - color = "Attrition").properties(height=200, width=250)) + color = "Attrition").properties(height=200, width=250) chart_environment = alt.Chart( df[(df['Department']==depart) & (df['Gender']==gender)&(df['Age']>=age[0])&(df['Age']<=age[1])], title='Environment Satisfaction').mark_bar().encode( - y=alt.Y('EnvironmentSatisfaction', title='', scale=alt.Scale(domain=["Bad", "Good", "Better", "Best"])), + y=alt.Y('EnvironmentSatisfaction', title=''), x=alt.X('count()', stack = 'normalize', axis=alt.Axis(format='%'), title = 'Proportion'), color='Attrition').properties(height=200, width=250)