By analyzing exit surveys from DETE and TAFE institutes our aim is to find what are the common reasons and biggest factors behind new and younger employees leaving their jobs.
Dataset
We will work with two datasets of exit interviews, one for each institute.
Analysis Goals
We will try to answer two key questions:
Are employees who only worked for the institutes for a short period of time resigning due to some kind of dissatisfaction? What about employees who have been there longer?
Are younger employees resigning due to some kind of dissatisfaction? What about older employees?
What kind of dissatisfaction (if any) will be considered in a secondary analysis.
# Importing libraries
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.style as style
style.use('seaborn')
dete_survey = pd.read_csv("dete_survey.csv")
tafe_survey = pd.read_csv("tafe_survey.csv")
In this section we will explore and familiarize ourselves with the data to answer questions like:
dete_survey.info()
<class 'pandas.core.frame.DataFrame'> RangeIndex: 822 entries, 0 to 821 Data columns (total 56 columns): # Column Non-Null Count Dtype --- ------ -------------- ----- 0 ID 822 non-null int64 1 SeparationType 822 non-null object 2 Cease Date 822 non-null object 3 DETE Start Date 822 non-null object 4 Role Start Date 822 non-null object 5 Position 817 non-null object 6 Classification 455 non-null object 7 Region 822 non-null object 8 Business Unit 126 non-null object 9 Employment Status 817 non-null object 10 Career move to public sector 822 non-null bool 11 Career move to private sector 822 non-null bool 12 Interpersonal conflicts 822 non-null bool 13 Job dissatisfaction 822 non-null bool 14 Dissatisfaction with the department 822 non-null bool 15 Physical work environment 822 non-null bool 16 Lack of recognition 822 non-null bool 17 Lack of job security 822 non-null bool 18 Work location 822 non-null bool 19 Employment conditions 822 non-null bool 20 Maternity/family 822 non-null bool 21 Relocation 822 non-null bool 22 Study/Travel 822 non-null bool 23 Ill Health 822 non-null bool 24 Traumatic incident 822 non-null bool 25 Work life balance 822 non-null bool 26 Workload 822 non-null bool 27 None of the above 822 non-null bool 28 Professional Development 808 non-null object 29 Opportunities for promotion 735 non-null object 30 Staff morale 816 non-null object 31 Workplace issue 788 non-null object 32 Physical environment 817 non-null object 33 Worklife balance 815 non-null object 34 Stress and pressure support 810 non-null object 35 Performance of supervisor 813 non-null object 36 Peer support 812 non-null object 37 Initiative 813 non-null object 38 Skills 811 non-null object 39 Coach 767 non-null object 40 Career Aspirations 746 non-null object 41 Feedback 792 non-null object 42 Further PD 768 non-null object 43 Communication 814 non-null object 44 My say 812 non-null object 45 Information 816 non-null object 46 Kept informed 813 non-null object 47 Wellness programs 766 non-null object 48 Health & Safety 793 non-null object 49 Gender 798 non-null object 50 Age 811 non-null object 51 Aboriginal 16 non-null object 52 Torres Strait 3 non-null object 53 South Sea 7 non-null object 54 Disability 23 non-null object 55 NESB 32 non-null object dtypes: bool(18), int64(1), object(37) memory usage: 258.6+ KB
dete_survey.head()
ID | SeparationType | Cease Date | DETE Start Date | Role Start Date | Position | Classification | Region | Business Unit | Employment Status | ... | Kept informed | Wellness programs | Health & Safety | Gender | Age | Aboriginal | Torres Strait | South Sea | Disability | NESB | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | 1 | Ill Health Retirement | 08/2012 | 1984 | 2004 | Public Servant | A01-A04 | Central Office | Corporate Strategy and Peformance | Permanent Full-time | ... | N | N | N | Male | 56-60 | NaN | NaN | NaN | NaN | Yes |
1 | 2 | Voluntary Early Retirement (VER) | 08/2012 | Not Stated | Not Stated | Public Servant | AO5-AO7 | Central Office | Corporate Strategy and Peformance | Permanent Full-time | ... | N | N | N | Male | 56-60 | NaN | NaN | NaN | NaN | NaN |
2 | 3 | Voluntary Early Retirement (VER) | 05/2012 | 2011 | 2011 | Schools Officer | NaN | Central Office | Education Queensland | Permanent Full-time | ... | N | N | N | Male | 61 or older | NaN | NaN | NaN | NaN | NaN |
3 | 4 | Resignation-Other reasons | 05/2012 | 2005 | 2006 | Teacher | Primary | Central Queensland | NaN | Permanent Full-time | ... | A | N | A | Female | 36-40 | NaN | NaN | NaN | NaN | NaN |
4 | 5 | Age Retirement | 05/2012 | 1970 | 1989 | Head of Curriculum/Head of Special Education | NaN | South East | NaN | Permanent Full-time | ... | N | A | M | Female | 61 or older | NaN | NaN | NaN | NaN | NaN |
5 rows × 56 columns
# Diving deeper to understand some columns. Experimental cell
# dete_survey.iloc[:,29].value_counts() # the unique values don't tell us anything
dete_survey.iloc[0:10,28:50]
dete_survey.iloc[:,48].value_counts(dropna=False)
dete_survey.iloc[:,50].value_counts(dropna=False) # Find unique vlaues for different columns of interest
61 or older 222 56-60 174 51-55 103 46-50 63 41-45 61 26-30 57 36-40 51 21-25 40 31-35 39 NaN 11 20 or younger 1 Name: Age, dtype: int64
Observations DETE Survey
What kind of information certain columnns hold?
Columns 28 to 48 contain coded answers which don't tell us much so they will dropped from our analysis.
Which columns are of key interest for the goal and which ones are we going to drop?
Since multiple columns represent some kind of dissatisfaction to better categorize it we will consider employees leaving due to any of the following reasons to be dissatisfied with work:
Some of the columns from the above list are also repeated and hence can be dropped
What kind of modifications may be needed to make the data more analysis ready?
We will need to perfrom the following key modifications:
Let's look for similar things in the TAFE dataset next.
tafe_survey.info()
<class 'pandas.core.frame.DataFrame'> RangeIndex: 702 entries, 0 to 701 Data columns (total 72 columns): # Column Non-Null Count Dtype --- ------ -------------- ----- 0 Record ID 702 non-null float64 1 Institute 702 non-null object 2 WorkArea 702 non-null object 3 CESSATION YEAR 695 non-null float64 4 Reason for ceasing employment 701 non-null object 5 Contributing Factors. Career Move - Public Sector 437 non-null object 6 Contributing Factors. Career Move - Private Sector 437 non-null object 7 Contributing Factors. Career Move - Self-employment 437 non-null object 8 Contributing Factors. Ill Health 437 non-null object 9 Contributing Factors. Maternity/Family 437 non-null object 10 Contributing Factors. Dissatisfaction 437 non-null object 11 Contributing Factors. Job Dissatisfaction 437 non-null object 12 Contributing Factors. Interpersonal Conflict 437 non-null object 13 Contributing Factors. Study 437 non-null object 14 Contributing Factors. Travel 437 non-null object 15 Contributing Factors. Other 437 non-null object 16 Contributing Factors. NONE 437 non-null object 17 Main Factor. Which of these was the main factor for leaving? 113 non-null object 18 InstituteViews. Topic:1. I feel the senior leadership had a clear vision and direction 608 non-null object 19 InstituteViews. Topic:2. I was given access to skills training to help me do my job better 613 non-null object 20 InstituteViews. Topic:3. I was given adequate opportunities for personal development 610 non-null object 21 InstituteViews. Topic:4. I was given adequate opportunities for promotion within %Institute]Q25LBL% 608 non-null object 22 InstituteViews. Topic:5. I felt the salary for the job was right for the responsibilities I had 615 non-null object 23 InstituteViews. Topic:6. The organisation recognised when staff did good work 607 non-null object 24 InstituteViews. Topic:7. Management was generally supportive of me 614 non-null object 25 InstituteViews. Topic:8. Management was generally supportive of my team 608 non-null object 26 InstituteViews. Topic:9. I was kept informed of the changes in the organisation which would affect me 610 non-null object 27 InstituteViews. Topic:10. Staff morale was positive within the Institute 602 non-null object 28 InstituteViews. Topic:11. If I had a workplace issue it was dealt with quickly 601 non-null object 29 InstituteViews. Topic:12. If I had a workplace issue it was dealt with efficiently 597 non-null object 30 InstituteViews. Topic:13. If I had a workplace issue it was dealt with discreetly 601 non-null object 31 WorkUnitViews. Topic:14. I was satisfied with the quality of the management and supervision within my work unit 609 non-null object 32 WorkUnitViews. Topic:15. I worked well with my colleagues 605 non-null object 33 WorkUnitViews. Topic:16. My job was challenging and interesting 607 non-null object 34 WorkUnitViews. Topic:17. I was encouraged to use my initiative in the course of my work 610 non-null object 35 WorkUnitViews. Topic:18. I had sufficient contact with other people in my job 613 non-null object 36 WorkUnitViews. Topic:19. I was given adequate support and co-operation by my peers to enable me to do my job 609 non-null object 37 WorkUnitViews. Topic:20. I was able to use the full range of my skills in my job 609 non-null object 38 WorkUnitViews. Topic:21. I was able to use the full range of my abilities in my job. ; Category:Level of Agreement; Question:YOUR VIEWS ABOUT YOUR WORK UNIT] 608 non-null object 39 WorkUnitViews. Topic:22. I was able to use the full range of my knowledge in my job 608 non-null object 40 WorkUnitViews. Topic:23. My job provided sufficient variety 611 non-null object 41 WorkUnitViews. Topic:24. I was able to cope with the level of stress and pressure in my job 610 non-null object 42 WorkUnitViews. Topic:25. My job allowed me to balance the demands of work and family to my satisfaction 611 non-null object 43 WorkUnitViews. Topic:26. My supervisor gave me adequate personal recognition and feedback on my performance 606 non-null object 44 WorkUnitViews. Topic:27. My working environment was satisfactory e.g. sufficient space, good lighting, suitable seating and working area 610 non-null object 45 WorkUnitViews. Topic:28. I was given the opportunity to mentor and coach others in order for me to pass on my skills and knowledge prior to my cessation date 609 non-null object 46 WorkUnitViews. Topic:29. There was adequate communication between staff in my unit 603 non-null object 47 WorkUnitViews. Topic:30. Staff morale was positive within my work unit 606 non-null object 48 Induction. Did you undertake Workplace Induction? 619 non-null object 49 InductionInfo. Topic:Did you undertake a Corporate Induction? 432 non-null object 50 InductionInfo. Topic:Did you undertake a Institute Induction? 483 non-null object 51 InductionInfo. Topic: Did you undertake Team Induction? 440 non-null object 52 InductionInfo. Face to Face Topic:Did you undertake a Corporate Induction; Category:How it was conducted? 555 non-null object 53 InductionInfo. On-line Topic:Did you undertake a Corporate Induction; Category:How it was conducted? 555 non-null object 54 InductionInfo. Induction Manual Topic:Did you undertake a Corporate Induction? 555 non-null object 55 InductionInfo. Face to Face Topic:Did you undertake a Institute Induction? 530 non-null object 56 InductionInfo. On-line Topic:Did you undertake a Institute Induction? 555 non-null object 57 InductionInfo. Induction Manual Topic:Did you undertake a Institute Induction? 553 non-null object 58 InductionInfo. Face to Face Topic: Did you undertake Team Induction; Category? 555 non-null object 59 InductionInfo. On-line Topic: Did you undertake Team Induction?process you undertook and how it was conducted.] 555 non-null object 60 InductionInfo. Induction Manual Topic: Did you undertake Team Induction? 555 non-null object 61 Workplace. Topic:Did you and your Manager develop a Performance and Professional Development Plan (PPDP)? 608 non-null object 62 Workplace. Topic:Does your workplace promote a work culture free from all forms of unlawful discrimination? 594 non-null object 63 Workplace. Topic:Does your workplace promote and practice the principles of employment equity? 587 non-null object 64 Workplace. Topic:Does your workplace value the diversity of its employees? 586 non-null object 65 Workplace. Topic:Would you recommend the Institute as an employer to others? 581 non-null object 66 Gender. What is your Gender? 596 non-null object 67 CurrentAge. Current Age 596 non-null object 68 Employment Type. Employment Type 596 non-null object 69 Classification. Classification 596 non-null object 70 LengthofServiceOverall. Overall Length of Service at Institute (in years) 596 non-null object 71 LengthofServiceCurrent. Length of Service at current workplace (in years) 596 non-null object dtypes: float64(2), object(70) memory usage: 395.0+ KB
tafe_survey.iloc[:,23].value_counts(dropna=False)
Agree 212 Neutral 136 Disagree 105 NaN 95 Strongly Agree 74 Strongly Disagree 73 Not Applicable 7 Name: InstituteViews. Topic:6. The organisation recognised when staff did good work, dtype: int64
Observations
What kind of information certain columnns hold?
Which columns are of key interest for the goal and which ones are we going to drop?
What kind of modifications may be needed to make the data more analysis ready?
This is where we will perform the modifications discussed above for both datasets.
dete_updated = dete_survey.drop(dete_survey.iloc[:,28:49],axis=1)
#dete_updated.columns = dete_updated.columns.str.strip()
dete_updated.info()
<class 'pandas.core.frame.DataFrame'> RangeIndex: 822 entries, 0 to 821 Data columns (total 35 columns): # Column Non-Null Count Dtype --- ------ -------------- ----- 0 ID 822 non-null int64 1 SeparationType 822 non-null object 2 Cease Date 822 non-null object 3 DETE Start Date 822 non-null object 4 Role Start Date 822 non-null object 5 Position 817 non-null object 6 Classification 455 non-null object 7 Region 822 non-null object 8 Business Unit 126 non-null object 9 Employment Status 817 non-null object 10 Career move to public sector 822 non-null bool 11 Career move to private sector 822 non-null bool 12 Interpersonal conflicts 822 non-null bool 13 Job dissatisfaction 822 non-null bool 14 Dissatisfaction with the department 822 non-null bool 15 Physical work environment 822 non-null bool 16 Lack of recognition 822 non-null bool 17 Lack of job security 822 non-null bool 18 Work location 822 non-null bool 19 Employment conditions 822 non-null bool 20 Maternity/family 822 non-null bool 21 Relocation 822 non-null bool 22 Study/Travel 822 non-null bool 23 Ill Health 822 non-null bool 24 Traumatic incident 822 non-null bool 25 Work life balance 822 non-null bool 26 Workload 822 non-null bool 27 None of the above 822 non-null bool 28 Gender 798 non-null object 29 Age 811 non-null object 30 Aboriginal 16 non-null object 31 Torres Strait 3 non-null object 32 South Sea 7 non-null object 33 Disability 23 non-null object 34 NESB 32 non-null object dtypes: bool(18), int64(1), object(16) memory usage: 123.7+ KB
dete_updated.columns = dete_updated.columns.str.strip()
dete_updated['Cease Date'].value_counts()
dete_updatedcopy = dete_updated.copy()
dete_updatedcopy['Cease_Year'] = dete_updatedcopy['Cease Date'].str.extract(r"([1-2][0-9]{3})") # Extracting only year
dete_updatedcopy['Cease_Year'].value_counts()
2013 380 2012 354 2014 51 2010 2 2006 1 Name: Cease_Year, dtype: int64
# Removing rows where start date is not known. It represents 9% of the data sample so it can be removed.
dete_updatedcopy = dete_updatedcopy[dete_updatedcopy['DETE Start Date'] != 'Not Stated']
dete_updatedcopy.rename(columns = {'DETE Start Date': 'Start_Year'}, inplace=True)
dete_updatedcopy['Start_Year'].value_counts()
2011 40 2007 34 2008 31 2010 27 2012 27 2009 24 2006 23 2013 21 1975 21 1970 21 2005 20 1990 20 1996 19 1999 19 1991 18 1992 18 2000 18 2004 18 1989 17 2003 15 1976 15 1988 15 1978 15 2002 15 1974 14 1998 14 1980 14 1997 14 1979 14 1995 14 1993 13 1986 12 1972 12 1977 11 1994 10 1971 10 2001 10 1984 10 1969 10 1983 9 1981 9 1985 8 1973 8 1987 7 1982 4 1963 4 1968 3 1967 2 1965 1 1966 1 Name: Start_Year, dtype: int64
dete_updatedcopy['Tenure'] = dete_updatedcopy['Cease_Year'].astype('float') - dete_updatedcopy['Start_Year'].astype('float')
dete_updatedcopy['Tenure'].describe()
count 719.000000 mean 18.379694 std 13.932555 min 0.000000 25% 5.000000 50% 16.000000 75% 31.000000 max 50.000000 Name: Tenure, dtype: float64
We want to categorize people's tenures based on the years. This article gives a nice baseline and we will use the slightly modified criteria as per below:
- New: Less than 3 years at a company
- Experienced: 3-6 years at a company
- Established: 7-10 years at a company
- Veteran: 11 or more years at a company
def expcategory(num):
if num < 3:
return 'New'
elif num <= 6:
return 'Experienced'
elif num <= 10:
return 'Established'
else: return 'Veteran'
dete_updatedcopy['Tenure_Cat'] = dete_updatedcopy['Tenure'].apply(expcategory)
dete_updatedcopy['Dissatisfaction'] = dete_updatedcopy.iloc[:,[13,14,15,16,17,19,25,26]].any(axis='columns') # categorizing dissatisfaction if any of the selected criteria is "True"
dete_updatedcopy.iloc[:,[13,14,15,16,17,19,25,26,38]].head() # verifying above step executed correctly
Job dissatisfaction | Dissatisfaction with the department | Physical work environment | Lack of recognition | Lack of job security | Employment conditions | Work life balance | Workload | Dissatisfaction | |
---|---|---|---|---|---|---|---|---|---|
0 | True | False | False | True | False | False | False | False | True |
2 | False | False | False | False | False | False | False | False | False |
3 | False | False | False | False | False | False | False | False | False |
4 | False | False | False | False | False | False | True | False | True |
5 | False | False | False | False | False | True | False | False | True |
dete_updatedcopy.iloc[:,29].value_counts().sort_values()
20 or younger 1 31-35 38 21-25 38 36-40 48 26-30 52 46-50 56 41-45 60 51-55 98 56-60 152 61 or older 201 Name: Age, dtype: int64
#dete_resonly[(dete_resonly["Dissatisfaction"] ==True) &
# (dete_resonly["Age"].isin(["21-25","26-30"]))].groupby(["Tenure_Cat","Age"]).agg({"Tenure_Cat": "count"})
dete_updatedcopy.loc[dete_updatedcopy['SeparationType'].str.contains('Resignation'), 'SeparationType'] = "Resignation"
#dete_updatedcopy= dete_updatedcopy.drop(dete_updatedcopy.iloc[:,[0,2,3,4,6,8,10,11,12,15,18,20,21,22,23,24,35]],axis=1)
dete_updatedcopy.info()
<class 'pandas.core.frame.DataFrame'> Int64Index: 749 entries, 0 to 820 Data columns (total 39 columns): # Column Non-Null Count Dtype --- ------ -------------- ----- 0 ID 749 non-null int64 1 SeparationType 749 non-null object 2 Cease Date 749 non-null object 3 Start_Year 749 non-null object 4 Role Start Date 749 non-null object 5 Position 744 non-null object 6 Classification 427 non-null object 7 Region 749 non-null object 8 Business Unit 115 non-null object 9 Employment Status 748 non-null object 10 Career move to public sector 749 non-null bool 11 Career move to private sector 749 non-null bool 12 Interpersonal conflicts 749 non-null bool 13 Job dissatisfaction 749 non-null bool 14 Dissatisfaction with the department 749 non-null bool 15 Physical work environment 749 non-null bool 16 Lack of recognition 749 non-null bool 17 Lack of job security 749 non-null bool 18 Work location 749 non-null bool 19 Employment conditions 749 non-null bool 20 Maternity/family 749 non-null bool 21 Relocation 749 non-null bool 22 Study/Travel 749 non-null bool 23 Ill Health 749 non-null bool 24 Traumatic incident 749 non-null bool 25 Work life balance 749 non-null bool 26 Workload 749 non-null bool 27 None of the above 749 non-null bool 28 Gender 732 non-null object 29 Age 744 non-null object 30 Aboriginal 15 non-null object 31 Torres Strait 3 non-null object 32 South Sea 6 non-null object 33 Disability 21 non-null object 34 NESB 30 non-null object 35 Cease_Year 719 non-null object 36 Tenure 719 non-null float64 37 Tenure_Cat 749 non-null object 38 Dissatisfaction 749 non-null bool dtypes: bool(19), float64(1), int64(1), object(18) memory usage: 136.8+ KB
tafe_survey.info()
#tafe_survey.columns = tafe_survey.columns.str.strip()
<class 'pandas.core.frame.DataFrame'> RangeIndex: 702 entries, 0 to 701 Data columns (total 72 columns): # Column Non-Null Count Dtype --- ------ -------------- ----- 0 Record ID 702 non-null float64 1 Institute 702 non-null object 2 WorkArea 702 non-null object 3 CESSATION YEAR 695 non-null float64 4 Reason for ceasing employment 701 non-null object 5 Contributing Factors. Career Move - Public Sector 437 non-null object 6 Contributing Factors. Career Move - Private Sector 437 non-null object 7 Contributing Factors. Career Move - Self-employment 437 non-null object 8 Contributing Factors. Ill Health 437 non-null object 9 Contributing Factors. Maternity/Family 437 non-null object 10 Contributing Factors. Dissatisfaction 437 non-null object 11 Contributing Factors. Job Dissatisfaction 437 non-null object 12 Contributing Factors. Interpersonal Conflict 437 non-null object 13 Contributing Factors. Study 437 non-null object 14 Contributing Factors. Travel 437 non-null object 15 Contributing Factors. Other 437 non-null object 16 Contributing Factors. NONE 437 non-null object 17 Main Factor. Which of these was the main factor for leaving? 113 non-null object 18 InstituteViews. Topic:1. I feel the senior leadership had a clear vision and direction 608 non-null object 19 InstituteViews. Topic:2. I was given access to skills training to help me do my job better 613 non-null object 20 InstituteViews. Topic:3. I was given adequate opportunities for personal development 610 non-null object 21 InstituteViews. Topic:4. I was given adequate opportunities for promotion within %Institute]Q25LBL% 608 non-null object 22 InstituteViews. Topic:5. I felt the salary for the job was right for the responsibilities I had 615 non-null object 23 InstituteViews. Topic:6. The organisation recognised when staff did good work 607 non-null object 24 InstituteViews. Topic:7. Management was generally supportive of me 614 non-null object 25 InstituteViews. Topic:8. Management was generally supportive of my team 608 non-null object 26 InstituteViews. Topic:9. I was kept informed of the changes in the organisation which would affect me 610 non-null object 27 InstituteViews. Topic:10. Staff morale was positive within the Institute 602 non-null object 28 InstituteViews. Topic:11. If I had a workplace issue it was dealt with quickly 601 non-null object 29 InstituteViews. Topic:12. If I had a workplace issue it was dealt with efficiently 597 non-null object 30 InstituteViews. Topic:13. If I had a workplace issue it was dealt with discreetly 601 non-null object 31 WorkUnitViews. Topic:14. I was satisfied with the quality of the management and supervision within my work unit 609 non-null object 32 WorkUnitViews. Topic:15. I worked well with my colleagues 605 non-null object 33 WorkUnitViews. Topic:16. My job was challenging and interesting 607 non-null object 34 WorkUnitViews. Topic:17. I was encouraged to use my initiative in the course of my work 610 non-null object 35 WorkUnitViews. Topic:18. I had sufficient contact with other people in my job 613 non-null object 36 WorkUnitViews. Topic:19. I was given adequate support and co-operation by my peers to enable me to do my job 609 non-null object 37 WorkUnitViews. Topic:20. I was able to use the full range of my skills in my job 609 non-null object 38 WorkUnitViews. Topic:21. I was able to use the full range of my abilities in my job. ; Category:Level of Agreement; Question:YOUR VIEWS ABOUT YOUR WORK UNIT] 608 non-null object 39 WorkUnitViews. Topic:22. I was able to use the full range of my knowledge in my job 608 non-null object 40 WorkUnitViews. Topic:23. My job provided sufficient variety 611 non-null object 41 WorkUnitViews. Topic:24. I was able to cope with the level of stress and pressure in my job 610 non-null object 42 WorkUnitViews. Topic:25. My job allowed me to balance the demands of work and family to my satisfaction 611 non-null object 43 WorkUnitViews. Topic:26. My supervisor gave me adequate personal recognition and feedback on my performance 606 non-null object 44 WorkUnitViews. Topic:27. My working environment was satisfactory e.g. sufficient space, good lighting, suitable seating and working area 610 non-null object 45 WorkUnitViews. Topic:28. I was given the opportunity to mentor and coach others in order for me to pass on my skills and knowledge prior to my cessation date 609 non-null object 46 WorkUnitViews. Topic:29. There was adequate communication between staff in my unit 603 non-null object 47 WorkUnitViews. Topic:30. Staff morale was positive within my work unit 606 non-null object 48 Induction. Did you undertake Workplace Induction? 619 non-null object 49 InductionInfo. Topic:Did you undertake a Corporate Induction? 432 non-null object 50 InductionInfo. Topic:Did you undertake a Institute Induction? 483 non-null object 51 InductionInfo. Topic: Did you undertake Team Induction? 440 non-null object 52 InductionInfo. Face to Face Topic:Did you undertake a Corporate Induction; Category:How it was conducted? 555 non-null object 53 InductionInfo. On-line Topic:Did you undertake a Corporate Induction; Category:How it was conducted? 555 non-null object 54 InductionInfo. Induction Manual Topic:Did you undertake a Corporate Induction? 555 non-null object 55 InductionInfo. Face to Face Topic:Did you undertake a Institute Induction? 530 non-null object 56 InductionInfo. On-line Topic:Did you undertake a Institute Induction? 555 non-null object 57 InductionInfo. Induction Manual Topic:Did you undertake a Institute Induction? 553 non-null object 58 InductionInfo. Face to Face Topic: Did you undertake Team Induction; Category? 555 non-null object 59 InductionInfo. On-line Topic: Did you undertake Team Induction?process you undertook and how it was conducted.] 555 non-null object 60 InductionInfo. Induction Manual Topic: Did you undertake Team Induction? 555 non-null object 61 Workplace. Topic:Did you and your Manager develop a Performance and Professional Development Plan (PPDP)? 608 non-null object 62 Workplace. Topic:Does your workplace promote a work culture free from all forms of unlawful discrimination? 594 non-null object 63 Workplace. Topic:Does your workplace promote and practice the principles of employment equity? 587 non-null object 64 Workplace. Topic:Does your workplace value the diversity of its employees? 586 non-null object 65 Workplace. Topic:Would you recommend the Institute as an employer to others? 581 non-null object 66 Gender. What is your Gender? 596 non-null object 67 CurrentAge. Current Age 596 non-null object 68 Employment Type. Employment Type 596 non-null object 69 Classification. Classification 596 non-null object 70 LengthofServiceOverall. Overall Length of Service at Institute (in years) 596 non-null object 71 LengthofServiceCurrent. Length of Service at current workplace (in years) 596 non-null object dtypes: float64(2), object(70) memory usage: 395.0+ KB
tafe_survey.iloc[:,4].value_counts(dropna=False)
tafe_survey.iloc[:,11].value_counts(dropna=False)
- 360 NaN 265 Job Dissatisfaction 77 Name: Contributing Factors. Job Dissatisfaction, dtype: int64
Assigning tenure category based on years of service
tafe_survey.iloc[:,70].str.strip()
tafe_survey.iloc[:,70].value_counts(dropna=False)
Less than 1 year 147 NaN 106 1-2 102 3-4 96 11-20 89 More than 20 years 71 5-6 48 7-10 43 Name: LengthofServiceOverall. Overall Length of Service at Institute (in years), dtype: int64
tafe_survey.rename(columns={tafe_survey.columns[70]: 'Tenure'}, inplace=True)
tafe_survey.loc[(tafe_survey['Tenure'] == "Less than 1 year") | (tafe_survey['Tenure'] == "1-2"), "Tenure_Cat"] = "New"
tafe_survey.loc[(tafe_survey['Tenure'] == "3-4") | (tafe_survey['Tenure'] == "5-6"), "Tenure_Cat"] = "Experienced"
tafe_survey.loc[(tafe_survey['Tenure'] == "11-20") | (tafe_survey['Tenure'] == "More than 20 years"), "Tenure_Cat"] = "Veteran"
tafe_survey.loc[tafe_survey['Tenure'] == "7-10", "Tenure_Cat"] = "Established"
tafe_survey.loc[pd.isnull(tafe_survey['Tenure']), "Tenure_Cat"] = "Unknown"
tafe_survey["Tenure_Cat"].value_counts()
New 249 Veteran 160 Experienced 144 Unknown 106 Established 43 Name: Tenure_Cat, dtype: int64
Modyfing certain column entries and designating columns for:
def newval(element):
if (element == "Agree" ) | (element == "Strongly Agree"):
return True
elif (element == "Disagree") | (element == "Strongly Disagree"):
return False
else:
return np.NaN
def yesnotruefalse(element):
if element == "Yes":
return True
elif element == "No":
return False
else:
return np.NaN
# Assigning column for Lack of recognition
tafe_survey['Recog'] = tafe_survey.iloc[:,[23,43]].applymap(newval).all(axis='columns',skipna=False)
tafe_survey.loc[tafe_survey['Recog']==False,'Lack of recognition'] = True
tafe_survey.loc[tafe_survey['Recog']==True, 'Lack of recognition'] = False
# Assigning column for Employment Conditions
tafe_survey['EmpCond'] = tafe_survey.iloc[:,[62,63,64]].applymap(yesnotruefalse).all(axis='columns',skipna=False)
tafe_survey.loc[tafe_survey['EmpCond']==True,'Employment conditions'] = False
tafe_survey.loc[tafe_survey['EmpCond']==False,'Employment conditions'] = True
tafe_survey.iloc[:,41].value_counts(dropna=False)
Agree 298 Strongly Agree 148 NaN 92 Neutral 91 Disagree 45 Strongly Disagree 22 Not Applicable 6 Name: WorkUnitViews. Topic:24. I was able to cope with the level of stress and pressure in my job, dtype: int64
# Assigning column for Workload
tafe_survey.loc[tafe_survey.iloc[:,41].apply(newval)==True,'Workload'] = False
tafe_survey.loc[tafe_survey.iloc[:,41].apply(newval)==False,'Workload'] = True
tafe_survey['Workload'].value_counts(dropna=False)
False 446 NaN 189 True 67 Name: Workload, dtype: int64
tafe_survey.iloc[:,42].value_counts(dropna=False)
Agree 290 Strongly Agree 141 Neutral 93 NaN 91 Disagree 53 Strongly Disagree 29 Not Applicable 5 Name: WorkUnitViews. Topic:25. My job allowed me to balance the demands of work and family to my satisfaction, dtype: int64
# Assigning column for Work life balance
tafe_survey.loc[tafe_survey.iloc[:,42].apply(newval)==True,'Work life balance'] = False
tafe_survey.loc[tafe_survey.iloc[:,42].apply(newval)==False,'Work life balance'] = True
tafe_survey['Work life balance'].value_counts(dropna=False)
False 431 NaN 189 True 82 Name: Work life balance, dtype: int64
# Assigning column for Physical work environment
tafe_survey.loc[tafe_survey.iloc[:,44].apply(newval)==True,'Physical work environment'] = False
tafe_survey.loc[tafe_survey.iloc[:,44].apply(newval)==False,'Physical work environment'] = True
tafe_survey['Physical work environment'].value_counts(dropna=False)
False 434 NaN 174 True 94 Name: Physical work environment, dtype: int64
tafe_survey.iloc[:,10].value_counts(dropna=False)
- 371 NaN 265 Contributing Factors. Dissatisfaction 66 Name: Contributing Factors. Dissatisfaction, dtype: int64
def update_vals(element):
if str(element).strip() == '-':
return False
elif pd.isnull(element):
return np.nan
else:
return True
tafe_survey['Other dissatisfaction'] = tafe_survey.iloc[:,10].apply(update_vals)
tafe_survey['Job dissatisfaction'] = tafe_survey.iloc[:,11].apply(update_vals)
tafe_survey.info()
<class 'pandas.core.frame.DataFrame'> RangeIndex: 702 entries, 0 to 701 Data columns (total 82 columns): # Column Non-Null Count Dtype --- ------ -------------- ----- 0 Record ID 702 non-null float64 1 Institute 702 non-null object 2 WorkArea 702 non-null object 3 CESSATION YEAR 695 non-null float64 4 Reason for ceasing employment 701 non-null object 5 Contributing Factors. Career Move - Public Sector 437 non-null object 6 Contributing Factors. Career Move - Private Sector 437 non-null object 7 Contributing Factors. Career Move - Self-employment 437 non-null object 8 Contributing Factors. Ill Health 437 non-null object 9 Contributing Factors. Maternity/Family 437 non-null object 10 Contributing Factors. Dissatisfaction 437 non-null object 11 Contributing Factors. Job Dissatisfaction 437 non-null object 12 Contributing Factors. Interpersonal Conflict 437 non-null object 13 Contributing Factors. Study 437 non-null object 14 Contributing Factors. Travel 437 non-null object 15 Contributing Factors. Other 437 non-null object 16 Contributing Factors. NONE 437 non-null object 17 Main Factor. Which of these was the main factor for leaving? 113 non-null object 18 InstituteViews. Topic:1. I feel the senior leadership had a clear vision and direction 608 non-null object 19 InstituteViews. Topic:2. I was given access to skills training to help me do my job better 613 non-null object 20 InstituteViews. Topic:3. I was given adequate opportunities for personal development 610 non-null object 21 InstituteViews. Topic:4. I was given adequate opportunities for promotion within %Institute]Q25LBL% 608 non-null object 22 InstituteViews. Topic:5. I felt the salary for the job was right for the responsibilities I had 615 non-null object 23 InstituteViews. Topic:6. The organisation recognised when staff did good work 607 non-null object 24 InstituteViews. Topic:7. Management was generally supportive of me 614 non-null object 25 InstituteViews. Topic:8. Management was generally supportive of my team 608 non-null object 26 InstituteViews. Topic:9. I was kept informed of the changes in the organisation which would affect me 610 non-null object 27 InstituteViews. Topic:10. Staff morale was positive within the Institute 602 non-null object 28 InstituteViews. Topic:11. If I had a workplace issue it was dealt with quickly 601 non-null object 29 InstituteViews. Topic:12. If I had a workplace issue it was dealt with efficiently 597 non-null object 30 InstituteViews. Topic:13. If I had a workplace issue it was dealt with discreetly 601 non-null object 31 WorkUnitViews. Topic:14. I was satisfied with the quality of the management and supervision within my work unit 609 non-null object 32 WorkUnitViews. Topic:15. I worked well with my colleagues 605 non-null object 33 WorkUnitViews. Topic:16. My job was challenging and interesting 607 non-null object 34 WorkUnitViews. Topic:17. I was encouraged to use my initiative in the course of my work 610 non-null object 35 WorkUnitViews. Topic:18. I had sufficient contact with other people in my job 613 non-null object 36 WorkUnitViews. Topic:19. I was given adequate support and co-operation by my peers to enable me to do my job 609 non-null object 37 WorkUnitViews. Topic:20. I was able to use the full range of my skills in my job 609 non-null object 38 WorkUnitViews. Topic:21. I was able to use the full range of my abilities in my job. ; Category:Level of Agreement; Question:YOUR VIEWS ABOUT YOUR WORK UNIT] 608 non-null object 39 WorkUnitViews. Topic:22. I was able to use the full range of my knowledge in my job 608 non-null object 40 WorkUnitViews. Topic:23. My job provided sufficient variety 611 non-null object 41 WorkUnitViews. Topic:24. I was able to cope with the level of stress and pressure in my job 610 non-null object 42 WorkUnitViews. Topic:25. My job allowed me to balance the demands of work and family to my satisfaction 611 non-null object 43 WorkUnitViews. Topic:26. My supervisor gave me adequate personal recognition and feedback on my performance 606 non-null object 44 WorkUnitViews. Topic:27. My working environment was satisfactory e.g. sufficient space, good lighting, suitable seating and working area 610 non-null object 45 WorkUnitViews. Topic:28. I was given the opportunity to mentor and coach others in order for me to pass on my skills and knowledge prior to my cessation date 609 non-null object 46 WorkUnitViews. Topic:29. There was adequate communication between staff in my unit 603 non-null object 47 WorkUnitViews. Topic:30. Staff morale was positive within my work unit 606 non-null object 48 Induction. Did you undertake Workplace Induction? 619 non-null object 49 InductionInfo. Topic:Did you undertake a Corporate Induction? 432 non-null object 50 InductionInfo. Topic:Did you undertake a Institute Induction? 483 non-null object 51 InductionInfo. Topic: Did you undertake Team Induction? 440 non-null object 52 InductionInfo. Face to Face Topic:Did you undertake a Corporate Induction; Category:How it was conducted? 555 non-null object 53 InductionInfo. On-line Topic:Did you undertake a Corporate Induction; Category:How it was conducted? 555 non-null object 54 InductionInfo. Induction Manual Topic:Did you undertake a Corporate Induction? 555 non-null object 55 InductionInfo. Face to Face Topic:Did you undertake a Institute Induction? 530 non-null object 56 InductionInfo. On-line Topic:Did you undertake a Institute Induction? 555 non-null object 57 InductionInfo. Induction Manual Topic:Did you undertake a Institute Induction? 553 non-null object 58 InductionInfo. Face to Face Topic: Did you undertake Team Induction; Category? 555 non-null object 59 InductionInfo. On-line Topic: Did you undertake Team Induction?process you undertook and how it was conducted.] 555 non-null object 60 InductionInfo. Induction Manual Topic: Did you undertake Team Induction? 555 non-null object 61 Workplace. Topic:Did you and your Manager develop a Performance and Professional Development Plan (PPDP)? 608 non-null object 62 Workplace. Topic:Does your workplace promote a work culture free from all forms of unlawful discrimination? 594 non-null object 63 Workplace. Topic:Does your workplace promote and practice the principles of employment equity? 587 non-null object 64 Workplace. Topic:Does your workplace value the diversity of its employees? 586 non-null object 65 Workplace. Topic:Would you recommend the Institute as an employer to others? 581 non-null object 66 Gender. What is your Gender? 596 non-null object 67 CurrentAge. Current Age 596 non-null object 68 Employment Type. Employment Type 596 non-null object 69 Classification. Classification 596 non-null object 70 Tenure 596 non-null object 71 LengthofServiceCurrent. Length of Service at current workplace (in years) 596 non-null object 72 Tenure_Cat 702 non-null object 73 Recog 536 non-null object 74 Lack of recognition 536 non-null object 75 EmpCond 590 non-null object 76 Employment conditions 590 non-null object 77 Workload 513 non-null object 78 Work life balance 513 non-null object 79 Physical work environment 528 non-null object 80 Other dissatisfaction 437 non-null object 81 Job dissatisfaction 437 non-null object dtypes: float64(2), object(80) memory usage: 449.8+ KB
tafe_survey['Dissatisfaction'] = tafe_survey.iloc[:,[74,76,77,78,79,80,81]].any(axis='columns')
tafe_survey['Dissatisfaction'].value_counts(dropna=False)
tafe_survey.iloc[:,[74,76,77,78,79,80,81,82]].head(20)
Lack of recognition | Employment conditions | Workload | Work life balance | Physical work environment | Other dissatisfaction | Job dissatisfaction | Dissatisfaction | |
---|---|---|---|---|---|---|---|---|
0 | False | False | False | False | False | NaN | NaN | False |
1 | False | False | False | False | False | False | False | False |
2 | False | False | False | False | False | False | False | False |
3 | False | False | False | False | False | False | False | False |
4 | False | False | False | False | False | False | False | False |
5 | NaN | NaN | NaN | True | True | False | False | True |
6 | False | False | False | False | False | False | False | False |
7 | NaN | False | True | True | NaN | False | False | True |
8 | False | False | False | False | False | False | False | False |
9 | False | False | False | False | False | False | False | False |
10 | False | False | False | False | False | False | False | False |
11 | False | True | False | False | False | NaN | NaN | True |
12 | False | False | False | False | False | NaN | NaN | False |
13 | False | False | False | False | True | False | False | True |
14 | True | False | True | False | False | True | True | True |
15 | True | False | False | False | False | False | False | True |
16 | NaN | NaN | NaN | NaN | NaN | NaN | NaN | False |
17 | NaN | False | NaN | NaN | True | False | True | True |
18 | NaN | NaN | NaN | NaN | NaN | NaN | NaN | False |
19 | NaN | NaN | NaN | NaN | NaN | False | False | False |
Formatting the entries in CurrentAge column to match the previous dataset.
tafe_survey.iloc[:,67].value_counts(dropna=False)
56 or older 162 NaN 106 51-55 82 41 45 80 46 50 59 31 35 52 36 40 51 26 30 50 21 25 44 20 or younger 16 Name: CurrentAge. Current Age, dtype: int64
tafe_survey['Age'] = tafe_survey.iloc[:,67].str.replace(" ","-")
tafe_survey['Age'].value_counts(dropna=False).sort_index()
20 or younger 16 21-25 44 26-30 50 31-35 52 36-40 51 41-45 80 46-50 59 51-55 82 56 or older 162 NaN 106 Name: Age, dtype: int64
As most of the data formatting/wrangling has been done we can now narrow down to only the relevant data and then merge it to have one dataset.
We will focus on the following:
dete_final = dete_updatedcopy.dropna(thresh=700,axis=1)
dete_final = dete_final.iloc[:,[1,11,12,13,14,15,17,23,24,26,27,29,30,31]]
dete_final.head()
SeparationType | Job dissatisfaction | Dissatisfaction with the department | Physical work environment | Lack of recognition | Lack of job security | Employment conditions | Work life balance | Workload | Gender | Age | Tenure | Tenure_Cat | Dissatisfaction | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | Ill Health Retirement | True | False | False | True | False | False | False | False | Male | 56-60 | 28.0 | Veteran | True |
2 | Voluntary Early Retirement (VER) | False | False | False | False | False | False | False | False | Male | 61 or older | 1.0 | New | False |
3 | Resignation | False | False | False | False | False | False | False | False | Female | 36-40 | 7.0 | Established | False |
4 | Age Retirement | False | False | False | False | False | False | True | False | Female | 61 or older | 42.0 | Veteran | True |
5 | Resignation | False | False | False | False | False | True | False | False | Female | 41-45 | 18.0 | Veteran | True |
tafe_survey=tafe_survey.rename(columns={tafe_survey.columns[4]: 'SeparationType',
tafe_survey.columns[66]: 'Gender'})
tafe_final = tafe_survey.iloc[:,[4,10,11,66,70,72,74,76,77,78,79,80,81,82,83]]
tafe_final.head()
SeparationType | Contributing Factors. Dissatisfaction | Contributing Factors. Job Dissatisfaction | Gender | Tenure | Tenure_Cat | Lack of recognition | Employment conditions | Workload | Work life balance | Physical work environment | Other dissatisfaction | Job dissatisfaction | Dissatisfaction | Age | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | Contract Expired | NaN | NaN | Female | 1-2 | New | False | False | False | False | False | NaN | NaN | False | 26-30 |
1 | Retirement | - | - | NaN | NaN | Unknown | False | False | False | False | False | False | False | False | NaN |
2 | Retirement | - | - | NaN | NaN | Unknown | False | False | False | False | False | False | False | False | NaN |
3 | Resignation | - | - | NaN | NaN | Unknown | False | False | False | False | False | False | False | False | NaN |
4 | Resignation | - | - | Male | 3-4 | Experienced | False | False | False | False | False | False | False | False | 41-45 |
for x,y in zip(['DETE','TAFE'], [dete_final,tafe_final]): # To avoid SettingWithCopyWarning
y['Institute']=x
<ipython-input-44-d571c870a7b9>:2: SettingWithCopyWarning: A value is trying to be set on a copy of a slice from a DataFrame. Try using .loc[row_indexer,col_indexer] = value instead See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
merged = pd.concat([dete_final,tafe_final],axis=0,ignore_index=False)
merged.info()
<class 'pandas.core.frame.DataFrame'> Int64Index: 1451 entries, 0 to 701 Data columns (total 18 columns): # Column Non-Null Count Dtype --- ------ -------------- ----- 0 SeparationType 1450 non-null object 1 Job dissatisfaction 1186 non-null object 2 Dissatisfaction with the department 749 non-null object 3 Physical work environment 1277 non-null object 4 Lack of recognition 1285 non-null object 5 Lack of job security 749 non-null object 6 Employment conditions 1339 non-null object 7 Work life balance 1262 non-null object 8 Workload 1262 non-null object 9 Gender 1328 non-null object 10 Age 1340 non-null object 11 Tenure 1315 non-null object 12 Tenure_Cat 1451 non-null object 13 Dissatisfaction 1451 non-null bool 14 Institute 1451 non-null object 15 Contributing Factors. Dissatisfaction 437 non-null object 16 Contributing Factors. Job Dissatisfaction 437 non-null object 17 Other dissatisfaction 437 non-null object dtypes: bool(1), object(17) memory usage: 205.5+ KB
septype = merged['SeparationType'].value_counts(dropna=False,normalize=True).apply('{:.0%}'.format)
septype
Resignation 43% Age Retirement 18% Contract Expired 11% Retrenchment/ Redundancy 7% Retirement 6% Voluntary Early Retirement (VER) 4% Ill Health Retirement 3% Other 3% Termination 3% Transfer 2% NaN 0% Name: SeparationType, dtype: object
septypebyage=merged.loc[merged['SeparationType']=='Resignation', 'Age'].value_counts(dropna=False,normalize=True).apply('{:.0%}'.format).sort_index()
septypebyage
20 or younger 2% 21-25 10% 26-30 10% 31-35 10% 36-40 11% 41-45 15% 46-50 12% 51-55 11% 56 or older 5% 56-60 4% 61 or older 3% NaN 8% Name: Age, dtype: object
Wanted to make a bar of pie graph but could not get it to work. Any help here is appreciated
%matplotlib inline import matplotlib.style as style
fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(9, 5)) fig.subplots_adjust(wspace=0.2)
overall_ratios = septype.values labels = septype.index explode = (0.05,0,0,0,0,0,0,0,0,0,0) ax1.pie(overall_ratios, explode=explode, labels=labels, autopct='%1.1f%%',startangle=-90, textprops={'fontsize': 8}) ax1.axis('equal') # Equal aspect ratio ensures that pie is drawn as a circle.
age_ratios = septypebyage.values[:5] age_labels = septypebyage.index[:5] bottom = 1 width = .2
for j, (height, l) in enumerate(reversed([*zip(age_ratios, age_labels)])): #bottom -= height bc = ax2.bar(0, height, width, label=l,color='C0', alpha=0.1 + 0.08 * j) #ax2.bar_label(bc, labels=[f"{height:.0%}"], label_type='center')
ax2.set_title('Age of approvers') ax2.legend() ax2.axis('off') ax2.set_xlim(- 2.5 * width, 2.5 * width) plt.show()
Since resignation is the biggest reason for employee turnover (43%) and young employees (up to 35 years of age) make up almost a third of this population we will concentrate on these two groups moving forward.
merged_youngres = merged[(merged['SeparationType'] == 'Resignation') & (merged['Age'].isin(['20 or younger','21-25','26-30','31-35']))]
merged_youngres['Dissatisfaction'] = merged_youngres['Dissatisfaction'].astype(int)
<ipython-input-48-379fa6bfc79a>:3: SettingWithCopyWarning: A value is trying to be set on a copy of a slice from a DataFrame. Try using .loc[row_indexer,col_indexer] = value instead See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
# Average percentage of young employees who left due to dissatisfaction
avgdis = (len(merged_youngres[merged_youngres['Dissatisfaction']==1]) / len(merged_youngres['Dissatisfaction'])) * 100
avgdis = float('{:.2f}'.format(avgdis))
avgdis
45.36
merged_youngres['Age'].value_counts().sort_index()
20 or younger 10 21-25 60 26-30 63 31-35 61 Name: Age, dtype: int64
pv_dis = merged_youngres.pivot_table(index='Age', aggfunc={'Age':'count','Dissatisfaction': ['sum',np.mean]})
pv_dis[('Dissatisfaction', 'mean')] = pv_dis[('Dissatisfaction', 'mean')].mul(100).apply('{:.2}'.format).astype(float)
pv_dis
Age | Dissatisfaction | ||
---|---|---|---|
count | mean | sum | |
Age | |||
20 or younger | 10 | 40.0 | 4.0 |
21-25 | 60 | 33.0 | 20.0 |
26-30 | 63 | 51.0 | 32.0 |
31-35 | 61 | 52.0 | 32.0 |
%matplotlib inline
import matplotlib.style as style
import matplotlib.ticker as mtick
style.use('seaborn')
fig,ax = plt.subplots()
ax.bar(x=pv_dis.index, height=pv_dis[('Dissatisfaction','mean')], width = 0.6)
ax.yaxis.set_major_formatter(mtick.PercentFormatter())
plt.ylim([0,60])
ax.axhline(y=avgdis,color='orange', linewidth=1, alpha=0.8,
xmin=0.01, xmax=0.98)
plt.show()
# Young resignations by institute DETE
dete_youngres = merged_youngres.loc[merged_youngres['Institute']== 'DETE']
pv_dete_youngres = dete_youngres.pivot_table(index='Age', aggfunc={'Age':'count','Dissatisfaction': ['sum',np.mean]})
pv_dete_youngres[('Dissatisfaction', 'mean')] = pv_dete_youngres[('Dissatisfaction', 'mean')].mul(100).apply('{:.2}'.format).astype(float)
pv_dete_youngres
Age | Dissatisfaction | ||
---|---|---|---|
count | mean | sum | |
Age | |||
20 or younger | 1 | 0.0 | 0.0 |
21-25 | 27 | 30.0 | 8.0 |
26-30 | 31 | 52.0 | 16.0 |
31-35 | 29 | 52.0 | 15.0 |
# Young resignations by institute DETE
tafe_youngres = merged_youngres.loc[merged_youngres['Institute']== 'TAFE']
pv_tafe_youngres = tafe_youngres.pivot_table(index='Age', aggfunc={'Age':'count','Dissatisfaction': ['sum',np.mean]})
pv_tafe_youngres[('Dissatisfaction', 'mean')] = pv_tafe_youngres[('Dissatisfaction', 'mean')].mul(100).apply('{:.2}'.format).astype(float)
pv_tafe_youngres
Age | Dissatisfaction | ||
---|---|---|---|
count | mean | sum | |
Age | |||
20 or younger | 9 | 44.0 | 4.0 |
21-25 | 33 | 36.0 | 12.0 |
26-30 | 32 | 50.0 | 16.0 |
31-35 | 32 | 53.0 | 17.0 |
# Plotting for both institutes
Xaxis = pv_dis.index
Y1 = pv_dete_youngres[('Dissatisfaction', 'mean')]
Y2 = pv_tafe_youngres[('Dissatisfaction', 'mean')]
X_pos = np.arange(len(Xaxis))
fig,ax = plt.subplots()
ax.bar(x=X_pos - 0.2, height=Y1, label="DETE", width=0.4)
ax.bar(x=X_pos + 0.2, height=Y2, label="TAFE", width= 0.4)
ax.set_xticks(X_pos)
ax.set_xticklabels(Xaxis)
ax.yaxis.set_major_formatter(mtick.PercentFormatter())
plt.ylim([0,60])
ax.set_title("Percentage of young employees leaving from dissatisfaction by institute")
for a in [0,1,2,3]:
ax.text(x=a+0.1, y = Y2[a]-2, s="{}%".format(Y2[a]))
ax.text(x=a-0.3, y = Y1[a]-2, s="{}%".format(Y1[a]))
ax.legend(loc='upper left')
plt.show()
merged_youngres.info()
<class 'pandas.core.frame.DataFrame'> Int64Index: 194 entries, 8 to 701 Data columns (total 18 columns): # Column Non-Null Count Dtype --- ------ -------------- ----- 0 SeparationType 194 non-null object 1 Job dissatisfaction 194 non-null object 2 Dissatisfaction with the department 88 non-null object 3 Physical work environment 173 non-null object 4 Lack of recognition 183 non-null object 5 Lack of job security 88 non-null object 6 Employment conditions 190 non-null object 7 Work life balance 176 non-null object 8 Workload 176 non-null object 9 Gender 193 non-null object 10 Age 194 non-null object 11 Tenure 193 non-null object 12 Tenure_Cat 194 non-null object 13 Dissatisfaction 194 non-null int64 14 Institute 194 non-null object 15 Contributing Factors. Dissatisfaction 106 non-null object 16 Contributing Factors. Job Dissatisfaction 106 non-null object 17 Other dissatisfaction 106 non-null object dtypes: int64(1), object(17) memory usage: 33.8+ KB
pv_tenuredis = merged_youngres.pivot_table(index='Tenure_Cat', aggfunc={'Tenure_Cat':'count','Dissatisfaction': ['sum',np.mean]})
pv_tenuredis[('Dissatisfaction', 'mean')] = pv_tenuredis[('Dissatisfaction', 'mean')].mul(100).apply('{:.2}'.format).astype(float)
pv_tenuredis
Dissatisfaction | Tenure_Cat | ||
---|---|---|---|
mean | sum | count | |
Tenure_Cat | |||
Established | 71.0 | 17.0 | 24 |
Experienced | 44.0 | 31.0 | 71 |
New | 39.0 | 36.0 | 93 |
Veteran | 67.0 | 4.0 | 6 |
# Tenure Cat resignations by institute DETE
dete_tenurecat_res = merged_youngres.loc[merged_youngres['Institute']== 'DETE']
pv_dete_tenurecat_res = dete_tenurecat_res.pivot_table(index='Tenure_Cat', aggfunc={'Tenure_Cat':'count','Dissatisfaction': ['sum',np.mean]})
pv_dete_tenurecat_res[('Dissatisfaction', 'mean')] = pv_dete_tenurecat_res[('Dissatisfaction', 'mean')].mul(100).apply('{:.2}'.format).astype(float)
pv_dete_tenurecat_res
Dissatisfaction | Tenure_Cat | ||
---|---|---|---|
mean | sum | count | |
Tenure_Cat | |||
Established | 59.0 | 10.0 | 17 |
Experienced | 41.0 | 16.0 | 39 |
New | 36.0 | 10.0 | 28 |
Veteran | 75.0 | 3.0 | 4 |
# Tenure Cat resignations by institute TAFE
tafe_tenurecat_res = merged_youngres.loc[merged_youngres['Institute']== 'TAFE']
pv_tafe_tenurecat_res = tafe_tenurecat_res.pivot_table(index='Tenure_Cat', aggfunc={'Tenure_Cat':'count','Dissatisfaction': ['sum',np.mean]})
pv_tafe_tenurecat_res[('Dissatisfaction', 'mean')] = pv_tafe_tenurecat_res[('Dissatisfaction', 'mean')].mul(100).apply('{:.2}'.format).astype(float)
pv_tafe_tenurecat_res
Dissatisfaction | Tenure_Cat | ||
---|---|---|---|
mean | sum | count | |
Tenure_Cat | |||
Established | 100.0 | 7.0 | 7 |
Experienced | 47.0 | 15.0 | 32 |
New | 40.0 | 26.0 | 65 |
Veteran | 50.0 | 1.0 | 2 |
%matplotlib inline
import matplotlib.style as style
import matplotlib.ticker as mtick
style.use('seaborn')
fig,((ax1,ax2),(ax3,ax4),(ax5,ax6)) = plt.subplots(3,2,figsize=(12,12))
ax1 = plt.subplot(3,2,1)
ax1.bar(x=pv_dis.index, height=pv_dis[('Dissatisfaction','mean')], width = 0.6)
ax1.yaxis.set_major_formatter(mtick.PercentFormatter())
plt.ylim([0,80])
ax1.axhline(y=avgdis,color='orange', linewidth=1, alpha=0.8,
xmin=0.01, xmax=0.98)
# By institute
ax2 = plt.subplot(3,2,3)
ax2.bar(x=X_pos - 0.2, height=Y1, label="DETE", width=0.4)
ax2.bar(x=X_pos + 0.2, height=Y2, label="TAFE", width= 0.4)
ax2.set_xticks(X_pos)
ax2.set_xticklabels(Xaxis)
ax2.yaxis.set_major_formatter(mtick.PercentFormatter())
plt.ylim([0,100])
ax2.legend(loc='upper left')
ax3= plt.subplot(3,2,2)
ax3.bar(x=pv_tenuredis.index, height = pv_tenuredis[('Dissatisfaction','mean')], width = 0.6)
ax3.yaxis.set_major_formatter(mtick.PercentFormatter())
plt.ylim([0,80])
# BY institute
X_axis = pv_tenuredis.index
Y_1 = pv_dete_tenurecat_res[('Dissatisfaction', 'mean')]
Y_2 = pv_tafe_tenurecat_res[('Dissatisfaction', 'mean')]
XPos = np.arange(len(X_axis))
ax4 = plt.subplot(3,2,4)
ax4.bar(x=XPos - 0.2, height=Y_1, label="DETE", width=0.4)
ax4.bar(x=XPos + 0.2, height=Y_2, label="TAFE", width= 0.4)
ax4.set_xticks(XPos)
ax4.set_xticklabels(X_axis)
ax4.yaxis.set_major_formatter(mtick.PercentFormatter())
plt.ylim([0,100])
ax4.legend(loc='upper right')
ax5 = plt.subplot(3,2,5)
ax5.bar(x=pv_tenuredis.index, height = pv_tenuredis[('Tenure_Cat','count')], width = 0.6)
ax6 = plt.subplot(3,2,6)
ax6.bar(x=XPos - 0.2, height=pv_dete_tenurecat_res[('Tenure_Cat', 'count')], label="DETE", width=0.4)
ax6.bar(x=XPos + 0.2, height=pv_tafe_tenurecat_res[('Tenure_Cat', 'count')], label="TAFE", width= 0.4)
ax6.set_xticks(XPos)
ax6.set_xticklabels(X_axis)
ax6.legend(loc='upper right')
fig.text(0.1,0.9,"Percentage of employee resignations due to dissatisfaction by Age group & Tenure cat",fontsize=14,weight='bold')
fig.patches.extend([plt.Rectangle((0.08,0.1),0.85,0.25,
fill=False, ec='black', alpha=0.9,lw=1, zorder=1000,
transform=fig.transFigure, figure=fig)])
plt.show()
The above results show us the following insights:
If we look at the information by institute, both DETE and TAFE institutes have a similar trend across age group and tenure category except for 'Established' employees where 100% of TAFE employees who resigned, did in fact leave due to dissatisfaction.
An additional insight that stands out is, overall new employees represent the largest portion of the young workforce who resigned, largest for TATE and second largest for DETE and over one-third of them left due to dissatisfaction. So it looks like the institutes have not been attractive enough over the last 3 years for new hires to stick around for long. And if this trend continues, it would suggest a generational disconnect.
Perhaps a different kind of survey such as stay interviews intended only for new hires would help them explore what they can do to become more attractive to the newer workforce.
We also have data about some sub-factors that represent dissatisfaction, so let's dive deeper and explore them for new hires.
merged_youngres1 = merged_youngres.fillna(False)
merged_youngres_corr=merged_youngres1.corr()['Dissatisfaction'].to_frame()
merged_youngres_corr.round(3)
Dissatisfaction | |
---|---|
Job dissatisfaction | 0.497 |
Dissatisfaction with the department | 0.228 |
Physical work environment | 0.351 |
Lack of recognition | 0.568 |
Lack of job security | 0.112 |
Employment conditions | 0.393 |
Work life balance | 0.460 |
Workload | 0.340 |
Dissatisfaction | 1.000 |
Other dissatisfaction | 0.306 |
ax = merged_youngres_corr[merged_youngres_corr.index != 'Dissatisfaction'].plot(kind='barh', legend=False)
for j in [0,3,6]:
highlight = merged_youngres_corr.index[j]
pos = merged_youngres_corr.index.get_loc(highlight)
ax.patches[pos].set_facecolor('#aa3333')
We see that overall dissatisfaction has a high correlation with work life balance, lack of recognition and job dissatisfaction. Let's see how many people left for each of the reasons.
subreason = merged_youngres1.loc[merged_youngres1['Dissatisfaction']== True].groupby('Dissatisfaction')[merged_youngres1.columns[1:8]].mean().mul(100).round(2).T
subreason_dete = merged_youngres1.loc[(merged_youngres1['Dissatisfaction']== True) & (merged_youngres1['Institute']=='DETE')].groupby('Dissatisfaction')[merged_youngres1.columns[1:8]].mean().mul(100).round(2).T
subreason_tafe = merged_youngres1.loc[(merged_youngres1['Dissatisfaction']== True) & (merged_youngres1['Institute']=='TAFE')].groupby('Dissatisfaction')[merged_youngres1.columns[1:8]].mean().mul(100).round(2).T
subreason_TenureCat= merged_youngres1.loc[merged_youngres1['Dissatisfaction']== True].groupby('Tenure_Cat')[merged_youngres1.columns[1:8]].mean().mul(100).round(2).T
subreason_TenureCat
#subreason_Age = merged_youngres1.loc[merged_youngres1['Dissatisfaction']== True].groupby('Age')[merged_youngres1.columns[1:8]].mean().mul(100).round(2).T
#subreason_Age
Tenure_Cat | Established | Experienced | New | Veteran |
---|---|---|---|---|
Job dissatisfaction | 35.29 | 41.94 | 36.11 | 25.0 |
Dissatisfaction with the department | 17.65 | 16.13 | 0.00 | 0.0 |
Physical work environment | 11.76 | 9.68 | 33.33 | 25.0 |
Lack of recognition | 47.06 | 51.61 | 44.44 | 25.0 |
Lack of job security | 5.88 | 3.23 | 0.00 | 0.0 |
Employment conditions | 17.65 | 29.03 | 27.78 | 0.0 |
Work life balance | 35.29 | 19.35 | 44.44 | 25.0 |
fig,ax = plt.subplots(figsize=(15,6))
Y_line = np.arange(len(subreason.index))
ax1 = plt.subplot(1,1,1)
ax1.barh(Y_line+0.4,subreason[1],height=0.2,label='Overall')
ax1.barh(Y_line+0.2,subreason_dete[1],height=0.2,label='DETE')
ax1.barh(Y_line,subreason_tafe[1],height=0.2,label='TAFE')
ax1.set_yticks(Y_line)
ax1.set_yticklabels(subreason.index)
ax1.legend(loc='upper right')
ax1.xaxis.set_major_formatter(mtick.PercentFormatter())
plt.xlim([0,70])
ax1.set(xlim=[0, 70], xlabel='Percentage of resignations')
plt.show()
fig, axes = plt.subplots(1, 1, figsize=(15, 10))
subreason_TenureCat.plot.barh(ax=axes,stacked=True)
#subreason_Age.plot.barh(ax=axes[1],stacked=True)
plt.yticks(fontsize=14)
plt.xticks(fontsize=14)
for b in ([0,2,3,6]):
axes.text((subreason_TenureCat['Established'][b]+subreason_TenureCat['Experienced'][b]+
subreason_TenureCat['New'][b]-20),y=b,s="{}%".format(subreason_TenureCat['New'][b]),fontsize=18,color='w')
After analyzing the sub-reasons across institutes and for 'New' employees, we can draw the following conclusions:
Lack of recognition is the biggest reason for dissatisfaction across young and new employees. While overall, 47% of employees felt lack of recognition, for TAFE institute that number was 62%.
In addition to not feeling recognized, new employees also mentioned Job dissatisfaction (36%), Physical work environment (33%), and work life balance (lack of) (44%) to be major reasons for leaving dissatisfied.
Established (7-10 years tenure) and Veteran (11 or more years tenure) employees who resigned from dissatisfaction had the lowest ratings across these sub-reasons, which shows they expected different things from work and their dissatisfaction stemmed from different reasons than for the newer generation.
No new employees left from lack of job security and overall it was less than 5%. So it is clear that the needs of the upcoming generation are different from the previous ones. They are not looking for monotonous jobs that are secure but not challenging enough, they want more recognition, a good work-life balance and perhaps get satisfaction from being challenged and rewarded.
Our recommendation would be for the institutes to look into improving the four key sub-reasons mentioned above and also look at wider research around changing workplace cultures so they can provide satisfaction in the ways that meets the definition for the next generation.