We are going to work with exit surveys from employees of the Department of Education, Training and Employment (DETE) and the Technical and Further Education (TAFE) institute in Queensland, Australia.
In this project, we'll be analysis the people who resigned due to some kind of dissatisfaction.
We will be combining both DETE and TAFE datasets to find out the dissatisfaction among the employees.
A data dictionary wasn't provided with the dataset. So for this project, we'll use our general knowledge to define the columns.
Below is a preview of a couple columns we'll work with from the dete_survey.csv:
Below is a preview of a couple columns we'll work with from the tafe_survey.csv:
After the analysis, we have found that
More established people are more prone to resign from their jobs due to dissatisfaction while the 'new' employees are the ones resigned the least due to dissatisfaction. 2nd place goes to the Veterans while the experienced employees take the 3rd place.
You can find the TAFE exit survey here and the survey for the DETE here. Tafe
https://data.gov.au/dataset/ds-qld-89970a3b-182b-41ea-aea2-6f9f17b5907e/details?q=exit%20survey
Dete https://data.gov.au/dataset/ds-qld-fe96ff30-d157-4a81-851d-215f2a0fe26d/details?q=exit%20survey
import numpy as np
import pandas as pd
#Reading the files
dete = pd.read_csv("dete_survey.csv")
tafe = pd.read_csv("tafe_survey.csv")
# Finding more info about DETE dataset
print(dete.info())
dete.head()
<class 'pandas.core.frame.DataFrame'> RangeIndex: 822 entries, 0 to 821 Data columns (total 56 columns): ID 822 non-null int64 SeparationType 822 non-null object Cease Date 822 non-null object DETE Start Date 822 non-null object Role Start Date 822 non-null object Position 817 non-null object Classification 455 non-null object Region 822 non-null object Business Unit 126 non-null object Employment Status 817 non-null object Career move to public sector 822 non-null bool Career move to private sector 822 non-null bool Interpersonal conflicts 822 non-null bool Job dissatisfaction 822 non-null bool Dissatisfaction with the department 822 non-null bool Physical work environment 822 non-null bool Lack of recognition 822 non-null bool Lack of job security 822 non-null bool Work location 822 non-null bool Employment conditions 822 non-null bool Maternity/family 822 non-null bool Relocation 822 non-null bool Study/Travel 822 non-null bool Ill Health 822 non-null bool Traumatic incident 822 non-null bool Work life balance 822 non-null bool Workload 822 non-null bool None of the above 822 non-null bool Professional Development 808 non-null object Opportunities for promotion 735 non-null object Staff morale 816 non-null object Workplace issue 788 non-null object Physical environment 817 non-null object Worklife balance 815 non-null object Stress and pressure support 810 non-null object Performance of supervisor 813 non-null object Peer support 812 non-null object Initiative 813 non-null object Skills 811 non-null object Coach 767 non-null object Career Aspirations 746 non-null object Feedback 792 non-null object Further PD 768 non-null object Communication 814 non-null object My say 812 non-null object Information 816 non-null object Kept informed 813 non-null object Wellness programs 766 non-null object Health & Safety 793 non-null object Gender 798 non-null object Age 811 non-null object Aboriginal 16 non-null object Torres Strait 3 non-null object South Sea 7 non-null object Disability 23 non-null object NESB 32 non-null object dtypes: bool(18), int64(1), object(37) memory usage: 258.6+ KB None
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
# Finding more info about TAFE dataset
print(tafe.info())
tafe.head()
<class 'pandas.core.frame.DataFrame'> RangeIndex: 702 entries, 0 to 701 Data columns (total 72 columns): Record ID 702 non-null float64 Institute 702 non-null object WorkArea 702 non-null object CESSATION YEAR 695 non-null float64 Reason for ceasing employment 701 non-null object Contributing Factors. Career Move - Public Sector 437 non-null object Contributing Factors. Career Move - Private Sector 437 non-null object Contributing Factors. Career Move - Self-employment 437 non-null object Contributing Factors. Ill Health 437 non-null object Contributing Factors. Maternity/Family 437 non-null object Contributing Factors. Dissatisfaction 437 non-null object Contributing Factors. Job Dissatisfaction 437 non-null object Contributing Factors. Interpersonal Conflict 437 non-null object Contributing Factors. Study 437 non-null object Contributing Factors. Travel 437 non-null object Contributing Factors. Other 437 non-null object Contributing Factors. NONE 437 non-null object Main Factor. Which of these was the main factor for leaving? 113 non-null object InstituteViews. Topic:1. I feel the senior leadership had a clear vision and direction 608 non-null object InstituteViews. Topic:2. I was given access to skills training to help me do my job better 613 non-null object InstituteViews. Topic:3. I was given adequate opportunities for personal development 610 non-null object InstituteViews. Topic:4. I was given adequate opportunities for promotion within %Institute]Q25LBL% 608 non-null object InstituteViews. Topic:5. I felt the salary for the job was right for the responsibilities I had 615 non-null object InstituteViews. Topic:6. The organisation recognised when staff did good work 607 non-null object InstituteViews. Topic:7. Management was generally supportive of me 614 non-null object InstituteViews. Topic:8. Management was generally supportive of my team 608 non-null object InstituteViews. Topic:9. I was kept informed of the changes in the organisation which would affect me 610 non-null object InstituteViews. Topic:10. Staff morale was positive within the Institute 602 non-null object InstituteViews. Topic:11. If I had a workplace issue it was dealt with quickly 601 non-null object InstituteViews. Topic:12. If I had a workplace issue it was dealt with efficiently 597 non-null object InstituteViews. Topic:13. If I had a workplace issue it was dealt with discreetly 601 non-null object WorkUnitViews. Topic:14. I was satisfied with the quality of the management and supervision within my work unit 609 non-null object WorkUnitViews. Topic:15. I worked well with my colleagues 605 non-null object WorkUnitViews. Topic:16. My job was challenging and interesting 607 non-null object WorkUnitViews. Topic:17. I was encouraged to use my initiative in the course of my work 610 non-null object WorkUnitViews. Topic:18. I had sufficient contact with other people in my job 613 non-null object 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 WorkUnitViews. Topic:20. I was able to use the full range of my skills in my job 609 non-null object 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 WorkUnitViews. Topic:22. I was able to use the full range of my knowledge in my job 608 non-null object WorkUnitViews. Topic:23. My job provided sufficient variety 611 non-null object WorkUnitViews. Topic:24. I was able to cope with the level of stress and pressure in my job 610 non-null object WorkUnitViews. Topic:25. My job allowed me to balance the demands of work and family to my satisfaction 611 non-null object WorkUnitViews. Topic:26. My supervisor gave me adequate personal recognition and feedback on my performance 606 non-null object WorkUnitViews. Topic:27. My working environment was satisfactory e.g. sufficient space, good lighting, suitable seating and working area 610 non-null object 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 WorkUnitViews. Topic:29. There was adequate communication between staff in my unit 603 non-null object WorkUnitViews. Topic:30. Staff morale was positive within my work unit 606 non-null object Induction. Did you undertake Workplace Induction? 619 non-null object InductionInfo. Topic:Did you undertake a Corporate Induction? 432 non-null object InductionInfo. Topic:Did you undertake a Institute Induction? 483 non-null object InductionInfo. Topic: Did you undertake Team Induction? 440 non-null object InductionInfo. Face to Face Topic:Did you undertake a Corporate Induction; Category:How it was conducted? 555 non-null object InductionInfo. On-line Topic:Did you undertake a Corporate Induction; Category:How it was conducted? 555 non-null object InductionInfo. Induction Manual Topic:Did you undertake a Corporate Induction? 555 non-null object InductionInfo. Face to Face Topic:Did you undertake a Institute Induction? 530 non-null object InductionInfo. On-line Topic:Did you undertake a Institute Induction? 555 non-null object InductionInfo. Induction Manual Topic:Did you undertake a Institute Induction? 553 non-null object InductionInfo. Face to Face Topic: Did you undertake Team Induction; Category? 555 non-null object InductionInfo. On-line Topic: Did you undertake Team Induction?process you undertook and how it was conducted.] 555 non-null object InductionInfo. Induction Manual Topic: Did you undertake Team Induction? 555 non-null object Workplace. Topic:Did you and your Manager develop a Performance and Professional Development Plan (PPDP)? 608 non-null object Workplace. Topic:Does your workplace promote a work culture free from all forms of unlawful discrimination? 594 non-null object Workplace. Topic:Does your workplace promote and practice the principles of employment equity? 587 non-null object Workplace. Topic:Does your workplace value the diversity of its employees? 586 non-null object Workplace. Topic:Would you recommend the Institute as an employer to others? 581 non-null object Gender. What is your Gender? 596 non-null object CurrentAge. Current Age 596 non-null object Employment Type. Employment Type 596 non-null object Classification. Classification 596 non-null object LengthofServiceOverall. Overall Length of Service at Institute (in years) 596 non-null object LengthofServiceCurrent. Length of Service at current workplace (in years) 596 non-null object dtypes: float64(2), object(70) memory usage: 395.0+ KB None
Record ID | Institute | WorkArea | CESSATION YEAR | Reason for ceasing employment | Contributing Factors. Career Move - Public Sector | Contributing Factors. Career Move - Private Sector | Contributing Factors. Career Move - Self-employment | Contributing Factors. Ill Health | Contributing Factors. Maternity/Family | ... | Workplace. Topic:Does your workplace promote a work culture free from all forms of unlawful discrimination? | Workplace. Topic:Does your workplace promote and practice the principles of employment equity? | Workplace. Topic:Does your workplace value the diversity of its employees? | Workplace. Topic:Would you recommend the Institute as an employer to others? | Gender. What is your Gender? | CurrentAge. Current Age | Employment Type. Employment Type | Classification. Classification | LengthofServiceOverall. Overall Length of Service at Institute (in years) | LengthofServiceCurrent. Length of Service at current workplace (in years) | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | 6.341330e+17 | Southern Queensland Institute of TAFE | Non-Delivery (corporate) | 2010.0 | Contract Expired | NaN | NaN | NaN | NaN | NaN | ... | Yes | Yes | Yes | Yes | Female | 26 30 | Temporary Full-time | Administration (AO) | 1-2 | 1-2 |
1 | 6.341337e+17 | Mount Isa Institute of TAFE | Non-Delivery (corporate) | 2010.0 | Retirement | - | - | - | - | - | ... | Yes | Yes | Yes | Yes | NaN | NaN | NaN | NaN | NaN | NaN |
2 | 6.341388e+17 | Mount Isa Institute of TAFE | Delivery (teaching) | 2010.0 | Retirement | - | - | - | - | - | ... | Yes | Yes | Yes | Yes | NaN | NaN | NaN | NaN | NaN | NaN |
3 | 6.341399e+17 | Mount Isa Institute of TAFE | Non-Delivery (corporate) | 2010.0 | Resignation | - | - | - | - | - | ... | Yes | Yes | Yes | Yes | NaN | NaN | NaN | NaN | NaN | NaN |
4 | 6.341466e+17 | Southern Queensland Institute of TAFE | Delivery (teaching) | 2010.0 | Resignation | - | Career Move - Private Sector | - | - | - | ... | Yes | Yes | Yes | Yes | Male | 41 45 | Permanent Full-time | Teacher (including LVT) | 3-4 | 3-4 |
5 rows × 72 columns
We can see that both data sets have a unique identifier under Record ID and ID. Similarly We can find columns with different names but with same content in each data sets. We will have to rename the columns and bring them together under one column name after cleaning the data.
We can also see the DETE start data column has 'Not Stated' as a response which is as good as a 'NaN' value. We can re-read the csv file and set 'Not Stated' as a NaN value.
dete = pd.read_csv('dete_survey.csv', na_values="Not Stated")
dete.head(2)
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.0 | 2004.0 | 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 | NaN | NaN | 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 rows × 56 columns
We have successfully removed 'Not Stated' values to NaN.
Now we have to remove some of the columns that won't add much value to our analysis.
print("DETE Columns \n -----------------", dete.columns[28:49], "\n \n")
print("TAFE Columns \n -----------------",tafe.columns[17:66])
DETE Columns ----------------- Index(['Professional Development', 'Opportunities for promotion', 'Staff morale', 'Workplace issue', 'Physical environment', 'Worklife balance', 'Stress and pressure support', 'Performance of supervisor', 'Peer support', 'Initiative', 'Skills', 'Coach', 'Career Aspirations', 'Feedback', 'Further PD', 'Communication', 'My say', 'Information', 'Kept informed', 'Wellness programs', 'Health & Safety'], dtype='object') TAFE Columns ----------------- Index(['Main Factor. Which of these was the main factor for leaving?', 'InstituteViews. Topic:1. I feel the senior leadership had a clear vision and direction', 'InstituteViews. Topic:2. I was given access to skills training to help me do my job better', 'InstituteViews. Topic:3. I was given adequate opportunities for personal development', 'InstituteViews. Topic:4. I was given adequate opportunities for promotion within %Institute]Q25LBL%', 'InstituteViews. Topic:5. I felt the salary for the job was right for the responsibilities I had', 'InstituteViews. Topic:6. The organisation recognised when staff did good work', 'InstituteViews. Topic:7. Management was generally supportive of me', 'InstituteViews. Topic:8. Management was generally supportive of my team', 'InstituteViews. Topic:9. I was kept informed of the changes in the organisation which would affect me', 'InstituteViews. Topic:10. Staff morale was positive within the Institute', 'InstituteViews. Topic:11. If I had a workplace issue it was dealt with quickly', 'InstituteViews. Topic:12. If I had a workplace issue it was dealt with efficiently', 'InstituteViews. Topic:13. If I had a workplace issue it was dealt with discreetly', 'WorkUnitViews. Topic:14. I was satisfied with the quality of the management and supervision within my work unit', 'WorkUnitViews. Topic:15. I worked well with my colleagues', 'WorkUnitViews. Topic:16. My job was challenging and interesting', 'WorkUnitViews. Topic:17. I was encouraged to use my initiative in the course of my work', 'WorkUnitViews. Topic:18. I had sufficient contact with other people in my job', 'WorkUnitViews. Topic:19. I was given adequate support and co-operation by my peers to enable me to do my job', 'WorkUnitViews. Topic:20. I was able to use the full range of my skills in my job', '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]', 'WorkUnitViews. Topic:22. I was able to use the full range of my knowledge in my job', 'WorkUnitViews. Topic:23. My job provided sufficient variety', 'WorkUnitViews. Topic:24. I was able to cope with the level of stress and pressure in my job', 'WorkUnitViews. Topic:25. My job allowed me to balance the demands of work and family to my satisfaction', 'WorkUnitViews. Topic:26. My supervisor gave me adequate personal recognition and feedback on my performance', 'WorkUnitViews. Topic:27. My working environment was satisfactory e.g. sufficient space, good lighting, suitable seating and working area', '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', 'WorkUnitViews. Topic:29. There was adequate communication between staff in my unit', 'WorkUnitViews. Topic:30. Staff morale was positive within my work unit', 'Induction. Did you undertake Workplace Induction?', 'InductionInfo. Topic:Did you undertake a Corporate Induction?', 'InductionInfo. Topic:Did you undertake a Institute Induction?', 'InductionInfo. Topic: Did you undertake Team Induction?', 'InductionInfo. Face to Face Topic:Did you undertake a Corporate Induction; Category:How it was conducted?', 'InductionInfo. On-line Topic:Did you undertake a Corporate Induction; Category:How it was conducted?', 'InductionInfo. Induction Manual Topic:Did you undertake a Corporate Induction?', 'InductionInfo. Face to Face Topic:Did you undertake a Institute Induction?', 'InductionInfo. On-line Topic:Did you undertake a Institute Induction?', 'InductionInfo. Induction Manual Topic:Did you undertake a Institute Induction?', 'InductionInfo. Face to Face Topic: Did you undertake Team Induction; Category?', 'InductionInfo. On-line Topic: Did you undertake Team Induction?process you undertook and how it was conducted.]', 'InductionInfo. Induction Manual Topic: Did you undertake Team Induction?', 'Workplace. Topic:Did you and your Manager develop a Performance and Professional Development Plan (PPDP)?', 'Workplace. Topic:Does your workplace promote a work culture free from all forms of unlawful discrimination?', 'Workplace. Topic:Does your workplace promote and practice the principles of employment equity?', 'Workplace. Topic:Does your workplace value the diversity of its employees?', 'Workplace. Topic:Would you recommend the Institute as an employer to others?'], dtype='object')
# Dropping the columns
dete_new = dete.drop(dete.columns[28:49], axis=1)
tafe_new = tafe.drop(tafe.columns[17:66],axis=1)
print("Rows and Columns in DETE Before and After : ", dete.shape, dete_new.shape)
print("Rows and Columns in TAFE Before and After : ",tafe.shape, tafe_new.shape)
Rows and Columns in DETE Before and After : (822, 56) (822, 35) Rows and Columns in TAFE Before and After : (702, 72) (702, 23)
We have removed columns that didn't add much value to our analysis and now we have 35 columns in DETE and 23 columns in TAFE data set.
Since we have lesser columns to work with, now it is a good time to standardise the column names.
First we will do the following in DETE data set
# Converting to lower case,replacing the white space and '/' with '_'
dete_new.columns = dete_new.columns.str.lower().str.replace(" ", "_").str.replace("/","_")
# Printing the updated column names
dete_new.columns
Index(['id', 'separationtype', 'cease_date', 'dete_start_date', 'role_start_date', 'position', 'classification', 'region', 'business_unit', 'employment_status', 'career_move_to_public_sector', 'career_move_to_private_sector', 'interpersonal_conflicts', 'job_dissatisfaction', 'dissatisfaction_with_the_department', 'physical_work_environment', 'lack_of_recognition', 'lack_of_job_security', 'work_location', 'employment_conditions', 'maternity_family', 'relocation', 'study_travel', 'ill_health', 'traumatic_incident', 'work_life_balance', 'workload', 'none_of_the_above', 'gender', 'age', 'aboriginal', 'torres_strait', 'south_sea', 'disability', 'nesb'], dtype='object')
We have successfully converted the names of dete columns. Now we will focus on TAFE data set.
We will do the below mentioned modifications on TAFE column names
name = {'Record ID': 'id',
'CESSATION YEAR': 'cease_date',
'Reason for ceasing employment': 'separationtype',
'Gender. What is your Gender?': 'gender',
'CurrentAge. Current Age': 'age',
'Employment Type. Employment Type': 'employment_status',
'Classification. Classification': 'position',
'LengthofServiceOverall. Overall Length of Service at Institute (in years)': 'institute_service',
'LengthofServiceCurrent. Length of Service at current workplace (in years)': 'role_service'}
# Renaming the column names
tafe_new.rename(columns=name, inplace=True)
# Printing the updated column names
tafe_new.columns
Index(['id', 'Institute', 'WorkArea', 'cease_date', 'separationtype', 'Contributing Factors. Career Move - Public Sector ', 'Contributing Factors. Career Move - Private Sector ', 'Contributing Factors. Career Move - Self-employment', 'Contributing Factors. Ill Health', 'Contributing Factors. Maternity/Family', 'Contributing Factors. Dissatisfaction', 'Contributing Factors. Job Dissatisfaction', 'Contributing Factors. Interpersonal Conflict', 'Contributing Factors. Study', 'Contributing Factors. Travel', 'Contributing Factors. Other', 'Contributing Factors. NONE', 'gender', 'age', 'employment_status', 'position', 'institute_service', 'role_service'], dtype='object')
We have updated the important column names of TAFE dataset as well.
Now we can look a bit in detail into these columns. The aim of this analysis is to find people who have resigned and to figure out if it was due to any sort of dissatisfaction.
So we will begin the analysis by creating a data set that has only people who have resgined. By looking at the seperationtype
column we can find more about it.
print("DETE separation types \n \n ----------- \n", dete_new['separationtype'].value_counts(dropna=False), "\n \n")
print("TAFE separation types \n \n ----------- \n", tafe_new['separationtype'].value_counts(dropna=False))
DETE separation types ----------- Age Retirement 285 Resignation-Other reasons 150 Resignation-Other employer 91 Resignation-Move overseas/interstate 70 Voluntary Early Retirement (VER) 67 Ill Health Retirement 61 Other 49 Contract Expired 34 Termination 15 Name: separationtype, dtype: int64 TAFE separation types ----------- Resignation 340 Contract Expired 127 Retrenchment/ Redundancy 104 Retirement 82 Transfer 25 Termination 23 NaN 1 Name: separationtype, dtype: int64
We can see that in TAFE there is one value called Resignation
while in
DETE data set there are 3 values called Resignation-Other reasons
, Resignation-Other employer
, Resignation-Move overseas/interstate
We will now create a sub set of data that has values connected with these resignation values.
# Creating a copy to avoid SettingWithCopy Warning
dete_resignation = dete_new.copy()
tafe_resignation = tafe_new.copy()
# Setting condition to select only data related to resignation
dete_condition = (
dete_resignation['separationtype'] == 'Resignation-Other reasons') | (
dete_resignation['separationtype'] == 'Resignation-Other employer') | (
dete_resignation['separationtype'] == 'Resignation-Move overseas/interstate')
tafe_condition = tafe_resignation['separationtype'] =='Resignation'
# Filtering the DETE Data set
dete_resignation = dete_resignation[dete_condition]
#filtering the TAFE Dataset
tafe_resignation = tafe_resignation[tafe_condition]
# Printing the filtered data set
dete_resignation.head()
id | separationtype | cease_date | dete_start_date | role_start_date | position | classification | region | business_unit | employment_status | ... | work_life_balance | workload | none_of_the_above | gender | age | aboriginal | torres_strait | south_sea | disability | nesb | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
3 | 4 | Resignation-Other reasons | 05/2012 | 2005.0 | 2006.0 | Teacher | Primary | Central Queensland | NaN | Permanent Full-time | ... | False | False | False | Female | 36-40 | NaN | NaN | NaN | NaN | NaN |
5 | 6 | Resignation-Other reasons | 05/2012 | 1994.0 | 1997.0 | Guidance Officer | NaN | Central Office | Education Queensland | Permanent Full-time | ... | False | False | False | Female | 41-45 | NaN | NaN | NaN | NaN | NaN |
8 | 9 | Resignation-Other reasons | 07/2012 | 2009.0 | 2009.0 | Teacher | Secondary | North Queensland | NaN | Permanent Full-time | ... | False | False | False | Female | 31-35 | NaN | NaN | NaN | NaN | NaN |
9 | 10 | Resignation-Other employer | 2012 | 1997.0 | 2008.0 | Teacher Aide | NaN | NaN | NaN | Permanent Part-time | ... | False | False | False | Female | 46-50 | NaN | NaN | NaN | NaN | NaN |
11 | 12 | Resignation-Move overseas/interstate | 2012 | 2009.0 | 2009.0 | Teacher | Secondary | Far North Queensland | NaN | Permanent Full-time | ... | False | False | False | Male | 31-35 | NaN | NaN | NaN | NaN | NaN |
5 rows × 35 columns
# Printing the filtered data set
tafe_resignation.head()
id | Institute | WorkArea | cease_date | separationtype | Contributing Factors. Career Move - Public Sector | Contributing Factors. Career Move - Private Sector | Contributing Factors. Career Move - Self-employment | Contributing Factors. Ill Health | Contributing Factors. Maternity/Family | ... | Contributing Factors. Study | Contributing Factors. Travel | Contributing Factors. Other | Contributing Factors. NONE | gender | age | employment_status | position | institute_service | role_service | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
3 | 6.341399e+17 | Mount Isa Institute of TAFE | Non-Delivery (corporate) | 2010.0 | Resignation | - | - | - | - | - | ... | - | Travel | - | - | NaN | NaN | NaN | NaN | NaN | NaN |
4 | 6.341466e+17 | Southern Queensland Institute of TAFE | Delivery (teaching) | 2010.0 | Resignation | - | Career Move - Private Sector | - | - | - | ... | - | - | - | - | Male | 41 45 | Permanent Full-time | Teacher (including LVT) | 3-4 | 3-4 |
5 | 6.341475e+17 | Southern Queensland Institute of TAFE | Delivery (teaching) | 2010.0 | Resignation | - | - | - | - | - | ... | - | - | Other | - | Female | 56 or older | Contract/casual | Teacher (including LVT) | 7-10 | 7-10 |
6 | 6.341520e+17 | Barrier Reef Institute of TAFE | Non-Delivery (corporate) | 2010.0 | Resignation | - | Career Move - Private Sector | - | - | Maternity/Family | ... | - | - | Other | - | Male | 20 or younger | Temporary Full-time | Administration (AO) | 3-4 | 3-4 |
7 | 6.341537e+17 | Southern Queensland Institute of TAFE | Delivery (teaching) | 2010.0 | Resignation | - | - | - | - | - | ... | - | - | Other | - | Male | 46 50 | Permanent Full-time | Teacher (including LVT) | 3-4 | 3-4 |
5 rows × 23 columns
Now these data sets contain only values connected with people who had resigned.
In order to find out the years of service, first we need to look at the cease_date column in dete_resignations
dete_resignation['cease_date'].value_counts()
2012 126 2013 74 01/2014 22 12/2013 17 06/2013 14 09/2013 11 11/2013 9 07/2013 9 10/2013 6 08/2013 4 05/2012 2 05/2013 2 07/2006 1 07/2012 1 09/2010 1 2010 1 Name: cease_date, dtype: int64
If we make the above column into a string and extract the last 4 digits, we will have the years value. We can convert it back to float for numerical caluclation.
# First converting into string, then extracting last 4 digits
# Lastly converting it to float
dete_resignation['cease_date'] = dete_resignation['cease_date'].astype(str).str[-4:].astype(float)
print("DETE start years : ",dete_resignation['dete_start_date'].value_counts())
print("TAFE cease years : ", tafe_resignation['cease_date'].value_counts())
DETE start years : 2011.0 24 2008.0 22 2007.0 21 2012.0 21 2010.0 17 2005.0 15 2004.0 14 2009.0 13 2006.0 13 2013.0 10 2000.0 9 1999.0 8 1996.0 6 2002.0 6 1992.0 6 1998.0 6 2003.0 6 1994.0 6 1993.0 5 1990.0 5 1980.0 5 1997.0 5 1991.0 4 1989.0 4 1988.0 4 1995.0 4 2001.0 3 1985.0 3 1986.0 3 1983.0 2 1976.0 2 1974.0 2 1971.0 1 1972.0 1 1984.0 1 1982.0 1 1987.0 1 1975.0 1 1973.0 1 1977.0 1 1963.0 1 Name: dete_start_date, dtype: int64 TAFE cease years : 2011.0 116 2012.0 94 2010.0 68 2013.0 55 2009.0 2 Name: cease_date, dtype: int64
All the years seems to be correct. Now we can find how many years one had worked in these places by finding the difference between cease date and start date. Interestingly, tafe_resignations dataframe already contains a "service" column, which we renamed to institute_service
Now we need to find one for DETE data set and we create a new column in DETE data set to store that value.
dete_resignation['institute_service'] = dete_resignation['cease_date']-dete_resignation['dete_start_date']
Now we have number of years one have worked in a place who had resigned. Now we need to find out if the resignation was because of any dissatifaction.
In order to find the dissatisfaction, we will use the below columns in tafe_resignation
And in dete_resigned
If in any of these columns the participants have given True
or Yes
to being dissatisfied, we will add a True
value in a new column called dissatisfied
.
We will start with TAFE data
print(tafe_resignation['Contributing Factors. Dissatisfaction'].value_counts(dropna=False))
print(tafe_resignation['Contributing Factors. Job Dissatisfaction'].value_counts(dropna=False))
- 277 Contributing Factors. Dissatisfaction 55 NaN 8 Name: Contributing Factors. Dissatisfaction, dtype: int64 - 270 Job Dissatisfaction 62 NaN 8 Name: Contributing Factors. Job Dissatisfaction, dtype: int64
We need to convert these responses into boolean values and NaN. So we will now create a function to do the same.
# Function to convert values in Bool & NaN
def update_vals(val):
if pd.isnull(val):
return np.nan
elif val == '-':
return False
else:
return True
tafe_cols = ['Contributing Factors. Dissatisfaction','Contributing Factors. Job Dissatisfaction']
#Updating the tafe_resignation column with bool
tafe_resignation[tafe_cols] = tafe_resignation[tafe_cols].applymap(update_vals)
tafe_resignation[tafe_cols].head()
Contributing Factors. Dissatisfaction | Contributing Factors. Job Dissatisfaction | |
---|---|---|
3 | False | False |
4 | False | False |
5 | False | False |
6 | False | False |
7 | False | False |
We can now see that we have successfully converted the values into Bool. Now we can go ahead and apply our logic to find who all are dissatisfied. Anyone who answered True
will be marked as dissatisfied.
# Creating a new column called 'dissatisfied' to store the value
tafe_resignation['dissatisfied'] = tafe_resignation[tafe_cols].any(axis=1, skipna=False)
tafe_resignation['dissatisfied'].value_counts(dropna=False)
False 241 True 91 NaN 8 Name: dissatisfied, dtype: int64
We can see that the new column has been created and it is storing the dissatisfied boolean values.
Now we do the same steps to DETE data set as well. In order to do that, we will have to find the index of the columns for easy operation.
dete_cols = ['job_dissatisfaction',
'dissatisfaction_with_the_department',
'physical_work_environment',
'lack_of_recognition',
'lack_of_job_security',
'work_location',
'employment_conditions',
'work_life_balance',
'workload']
# Finding the index of column names
[dete_resignation.columns.get_loc(col) for col in dete_cols]
[13, 14, 15, 16, 17, 18, 19, 25, 26]
# Selecting all the column names
dete_resignation.iloc[:,np.r_[13:20,25:27]]
job_dissatisfaction | dissatisfaction_with_the_department | physical_work_environment | lack_of_recognition | lack_of_job_security | work_location | employment_conditions | work_life_balance | workload | |
---|---|---|---|---|---|---|---|---|---|
3 | False | False | False | False | False | False | False | False | False |
5 | False | False | False | False | False | False | True | False | False |
8 | False | False | False | False | False | False | False | False | False |
9 | True | True | False | False | False | False | False | False | False |
11 | False | False | False | False | False | False | False | False | False |
12 | False | False | False | False | False | False | False | False | False |
14 | True | True | False | False | False | False | False | False | False |
16 | False | False | False | True | False | False | False | False | False |
20 | False | False | False | False | False | False | False | False | False |
21 | False | False | False | False | False | False | False | False | False |
22 | False | True | False | True | False | False | False | True | False |
23 | True | False | False | False | False | True | False | True | False |
25 | False | False | False | False | False | False | False | True | False |
27 | False | False | False | False | False | False | False | False | False |
33 | False | False | False | True | False | False | False | False | False |
34 | False | False | False | False | False | False | False | True | False |
37 | False | False | False | False | False | False | False | False | False |
39 | True | False | False | True | False | False | True | True | False |
40 | False | False | False | False | False | False | False | False | False |
41 | False | False | False | False | False | False | False | True | False |
42 | False | False | False | False | False | False | False | False | False |
43 | True | False | False | False | False | False | False | True | True |
48 | False | False | False | False | False | False | False | False | False |
50 | False | False | False | False | False | False | False | False | False |
51 | False | False | False | False | False | False | False | False | False |
55 | False | False | False | False | False | False | False | False | False |
57 | False | False | False | False | False | False | False | False | False |
61 | False | False | False | False | False | False | False | False | False |
69 | True | False | False | False | False | True | False | False | False |
71 | False | False | False | False | False | False | False | False | False |
... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
747 | False | False | False | False | False | False | False | False | False |
751 | True | False | False | False | False | False | False | False | False |
752 | False | False | False | False | False | False | False | False | False |
753 | True | False | False | False | False | False | False | True | False |
755 | False | False | False | False | False | False | False | False | False |
762 | False | False | False | False | False | False | False | False | False |
766 | False | False | False | False | False | False | False | False | False |
769 | False | False | False | False | False | False | False | False | False |
770 | False | False | False | False | False | False | False | False | False |
771 | False | False | False | False | False | False | False | False | False |
774 | False | False | False | False | False | False | False | False | False |
784 | True | False | False | True | False | False | False | True | False |
786 | True | False | False | False | True | False | False | False | False |
788 | False | False | False | False | False | False | False | False | False |
789 | False | False | False | False | False | False | False | False | False |
790 | False | False | False | True | False | False | True | False | True |
791 | False | False | False | True | False | False | False | False | False |
794 | False | False | False | False | False | False | False | False | False |
797 | False | False | False | False | False | False | False | False | False |
798 | False | False | False | False | False | False | False | False | False |
802 | False | False | False | False | False | False | False | False | False |
803 | False | False | False | False | False | False | False | False | False |
804 | False | False | False | False | False | False | False | False | False |
806 | False | False | False | False | False | False | False | False | False |
807 | False | True | False | False | False | False | False | True | False |
808 | False | False | False | False | False | False | False | False | False |
815 | False | False | False | False | False | False | False | False | False |
816 | False | False | False | False | False | False | False | False | False |
819 | False | False | False | False | False | False | False | True | False |
821 | False | False | False | False | False | False | False | False | False |
311 rows × 9 columns
We can see that the selected columns already have data in boolean values. So we can straight away go ahead and apply any() function to get our 'dissatisfied' value.
dete_resignation['dissatisfied'] = dete_resignation.iloc[:,np.r_[13:20,25:27]].any(axis=1, skipna=False)
dete_resignation['dissatisfied'].value_counts(dropna=False)
False 162 True 149 Name: dissatisfied, dtype: int64
Now we have dissatisfied column on both data sets.
So far we have done
Now we are ready to combine the two datasets that we were working on into one. We will aggregate our data set into to based on institute_service
column.
Before we aggregate in order to identify the rows easily after the aggregation, we will add institute
column for both data sets.
dete_resignation['institute'] = 'DETE'
tafe_resignation['institute'] = 'TAFE'
combined = pd.concat([dete_resignation, tafe_resignation])
combined.head()
Contributing Factors. Career Move - Private Sector | Contributing Factors. Career Move - Public Sector | Contributing Factors. Career Move - Self-employment | Contributing Factors. Dissatisfaction | Contributing Factors. Ill Health | Contributing Factors. Interpersonal Conflict | Contributing Factors. Job Dissatisfaction | Contributing Factors. Maternity/Family | Contributing Factors. NONE | Contributing Factors. Other | ... | role_service | role_start_date | separationtype | south_sea | study_travel | torres_strait | traumatic_incident | work_life_balance | work_location | workload | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
3 | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | ... | NaN | 2006.0 | Resignation-Other reasons | NaN | False | NaN | False | False | False | False |
5 | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | ... | NaN | 1997.0 | Resignation-Other reasons | NaN | False | NaN | False | False | False | False |
8 | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | ... | NaN | 2009.0 | Resignation-Other reasons | NaN | False | NaN | False | False | False | False |
9 | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | ... | NaN | 2008.0 | Resignation-Other employer | NaN | False | NaN | False | False | False | False |
11 | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | ... | NaN | 2009.0 | Resignation-Move overseas/interstate | NaN | False | NaN | False | False | False | False |
5 rows × 53 columns
We have successfully combined the 2 data sets. But it looks like there are many NaN values in the data set. We can look at the number of null values present in each column and then if it is more than a certain number we can drop them.
combined.notnull().sum().sort_values(ascending=False)
institute 651 separationtype 651 id 651 dissatisfied 643 cease_date 635 position 598 employment_status 597 age 596 gender 592 institute_service 563 Institute 340 WorkArea 340 Contributing Factors. Interpersonal Conflict 332 Contributing Factors. Job Dissatisfaction 332 Contributing Factors. Maternity/Family 332 Contributing Factors. NONE 332 Contributing Factors. Ill Health 332 Contributing Factors. Dissatisfaction 332 Contributing Factors. Study 332 Contributing Factors. Travel 332 Contributing Factors. Career Move - Self-employment 332 Contributing Factors. Career Move - Public Sector 332 Contributing Factors. Other 332 Contributing Factors. Career Move - Private Sector 332 ill_health 311 career_move_to_private_sector 311 work_life_balance 311 traumatic_incident 311 study_travel 311 relocation 311 physical_work_environment 311 none_of_the_above 311 maternity_family 311 interpersonal_conflicts 311 lack_of_recognition 311 workload 311 dissatisfaction_with_the_department 311 job_dissatisfaction 311 lack_of_job_security 311 work_location 311 employment_conditions 311 career_move_to_public_sector 311 role_service 290 dete_start_date 283 role_start_date 271 region 265 classification 161 business_unit 32 nesb 9 disability 8 aboriginal 7 south_sea 3 torres_strait 0 dtype: int64
We can see that most of the columns that we need to continue further analysis have more than 500 non-null values. So we can set 500 as the threshold to drop non-null vlaues.
combined_new = combined.dropna(thresh=500, axis=1)
combined_new.head()
age | cease_date | dissatisfied | employment_status | gender | id | institute | institute_service | position | separationtype | |
---|---|---|---|---|---|---|---|---|---|---|
3 | 36-40 | 2012.0 | False | Permanent Full-time | Female | 4.0 | DETE | 7 | Teacher | Resignation-Other reasons |
5 | 41-45 | 2012.0 | True | Permanent Full-time | Female | 6.0 | DETE | 18 | Guidance Officer | Resignation-Other reasons |
8 | 31-35 | 2012.0 | False | Permanent Full-time | Female | 9.0 | DETE | 3 | Teacher | Resignation-Other reasons |
9 | 46-50 | 2012.0 | True | Permanent Part-time | Female | 10.0 | DETE | 15 | Teacher Aide | Resignation-Other employer |
11 | 31-35 | 2012.0 | False | Permanent Full-time | Male | 12.0 | DETE | 3 | Teacher | Resignation-Move overseas/interstate |
Now that we have cleaned most of our data set, we are almost ready for the analysis. Before going into that, we can have a closer look at the columns. Since institute_service will be an important column, we will have a look at it first.
combined_new['institute_service']
3 7 5 18 8 3 9 15 11 3 12 14 14 5 16 NaN 20 30 21 32 22 15 23 39 25 17 27 7 33 9 34 6 37 1 39 NaN 40 35 41 38 42 1 43 36 48 3 50 3 51 19 55 4 57 9 61 1 69 6 71 1 ... 659 1-2 660 3-4 661 5-6 665 NaN 666 NaN 669 3-4 670 NaN 671 Less than 1 year 675 Less than 1 year 676 1-2 677 Less than 1 year 678 3-4 679 1-2 681 Less than 1 year 682 Less than 1 year 683 Less than 1 year 684 3-4 685 1-2 686 5-6 688 5-6 689 Less than 1 year 690 NaN 691 3-4 693 1-2 694 NaN 696 5-6 697 1-2 698 NaN 699 5-6 701 3-4 Name: institute_service, Length: 651, dtype: object
We can see that there are two types of data in this column, one is a number while the other is a range of years. We can go ahead and categorize these into groups.
We will follow the below mentioned definition to group.
First we will extract the years from these values and then compare and group them into thier respective categories.
# Reseting the index after all the dropping of rows and cols
combined_new.reset_index(inplace=True, drop=True)
# Creating a copy to avoid SettingWithCopy warning
combined_new_up = combined_new.copy()
# Updating the institute service column
combined_new_up['institute_service_up'] = combined_new_up['institute_service'].astype(str).str.extract(r"(\d+)", expand=False).astype(float)
# Function to sort out years of working
def sorter(val):
if val < 3:
return 'new'
elif val < 7:
return 'experienced'
elif val < 11:
return 'established'
else:
return 'veteran'
combined_new_up['service_category'] = combined_new_up['institute_service_up'].apply(sorter)
combined_new_up['dissatisfied'].value_counts(dropna=False)
False 403 True 240 NaN 8 Name: dissatisfied, dtype: int64
We can see that still there are 8 rows have NaN value in dissatisfied column. Since it is a small percentage of missing values, we can replace the missing values with the most frequent value, which is False
.
combined_new_up['dissatisfied'] = combined_new_up['dissatisfied'].fillna(False)
combined_new_up['dissatisfied'].value_counts(dropna=False)
False 411 True 240 Name: dissatisfied, dtype: int64
Now that we have all the values for dissatisfied people, we can use pivot table method to find number of dissatisfied people in each service category. We can find the mean of them.
pd.pivot_table(combined_new_up, index='service_category', values='dissatisfied', aggfunc=np.mean)
dissatisfied | |
---|---|
service_category | |
established | 0.516129 |
experienced | 0.343023 |
new | 0.295337 |
veteran | 0.410714 |
%matplotlib inline
# Plotting the dissatified employees in each service category
pd.pivot_table(
combined_new_up, index='service_category', values='dissatisfied'
).sort_values('dissatisfied', ascending=False
).plot.bar(
rot=0, title='Dissatisfied resignees in each Service category')
<matplotlib.axes._subplots.AxesSubplot at 0x7f7d4ad3d470>
After cleaning, dropping, aggregating and filling missing values, we have finally found out a percentage of dissatisfied employees in each service category.
We can see that more established people are more prone to resign from their jobs due to dissatisfaction while the 'new' employees are the ones resigned the least due to dissatisfaction. 2nd place goes to the Veterans while the experienced employees take the 3rd place.