In this project, we'll aim to find if age and years of work affect the likelihood of quitting due to job dissatisfaction at the Department of Education, Training, and Employment(DETE) and the Techincal and Further education institute(TAFE).
We'll analyze the exit survey from DETE and TAFE, to try to find out the following:
After analyzing the data, we can say that years at work have a more significant impact on resignations due to job dissatisfaction than employee age.
Resignations due to dissatisfaction across ages range from 35% to 43%, except with younger employees, for which it varies from 20% to 30%.
On the other hand, over 55% of the Established employees resign due to job dissatisfaction, whereas only 30% of the resignations from new and experienced employees are due to job dissatisfaction. This suggests that years spend at the workplace has an impact on job dissatisfaction.
For more details, please refer to the full analysis below.
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
dete_survey = pd.read_csv('dete_survey.csv')
tafe_survey = pd.read_csv('tafe_survey.csv')
dete_survey.info()
<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
dete_survey
has 822 rows and 56 columns.Next we will explore the first five rows to understand which columns can be useful for our analysis.
dete_survey.head(5)
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
Some of the columns that we will use for our analysis are:
SeparationType
as we are interested in resignation onlyCease Date
and DETE Start Date to analyze variance between recent workers and long time workersAge
to analyze the differences between young and older workersWe can see that the dissatisfaction criteria are listed in columns, suggesting that we will need to tidy up the data to perform our analysis—moreover, there a few columns with missing values. In the next step, we are going to summarize the missing values.
dete_survey.isnull().sum()
ID 0 SeparationType 0 Cease Date 0 DETE Start Date 0 Role Start Date 0 Position 5 Classification 367 Region 0 Business Unit 696 Employment Status 5 Career move to public sector 0 Career move to private sector 0 Interpersonal conflicts 0 Job dissatisfaction 0 Dissatisfaction with the department 0 Physical work environment 0 Lack of recognition 0 Lack of job security 0 Work location 0 Employment conditions 0 Maternity/family 0 Relocation 0 Study/Travel 0 Ill Health 0 Traumatic incident 0 Work life balance 0 Workload 0 None of the above 0 Professional Development 14 Opportunities for promotion 87 Staff morale 6 Workplace issue 34 Physical environment 5 Worklife balance 7 Stress and pressure support 12 Performance of supervisor 9 Peer support 10 Initiative 9 Skills 11 Coach 55 Career Aspirations 76 Feedback 30 Further PD 54 Communication 8 My say 10 Information 6 Kept informed 9 Wellness programs 56 Health & Safety 29 Gender 24 Age 11 Aboriginal 806 Torres Strait 819 South Sea 815 Disability 799 NESB 790 dtype: int64
From the table above, we can see that the columns, Aboriginal
, Torres Strait
, South Sea
, Disability
, NSEB
, and business units, have from 669 to 815 missing values. Also, the Classification
columns have 367 missing values. Those columns do not contain the data needed for the analysis. Therefore we can drop them.
In the next step, we are going to explore the tafe_survey
.
tafe_survey.info()
<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
tafe_survey
has 702 rows and 72 columns.
Next, we are going to explore the first five rows.
tafe_survey.head(5)
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 the header names are long a complex, we will need to clean them up to make the data more readable. Some of the columns that we will use in our analysis are:
Reason fo ceasing employment
; as we are analyzing resignations onlyLenghofServiceOverall. Overall Lenght of Service at Insititute
; to see differences between long term employees and recently hired employees.The current age
to analyze the difference between age groups.As we have seen above, there are a few data cleaning steps that we need to take to have a tidy dataset.
We will start by reimporting the dete_survey
data and assigning Not Stated
values to NaN
.
dete_survey = pd.read_csv('dete_survey.csv',na_values ="Not Stated")
dete_survey.head(5)
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 | 3 | Voluntary Early Retirement (VER) | 05/2012 | 2011.0 | 2011.0 | 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.0 | 2006.0 | 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.0 | 1989.0 | 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
In the next step, we are going to drop the columns that we won't use in our analysis.
In the dete_survey
we will drop columns 28 to 49.
#Dropping unecessary columns
dete_survey_updated = dete_survey.drop(dete_survey.columns[28:49],axis =1)
old_columns = dete_survey.shape[1]
new_columns= dete_survey_updated.shape[1]
"dete_survey had {} columns and now has {} columns".format(old_columns,new_columns)
'dete_survey had 56 columns and now has 35 columns'
In the next step, we will remove columns 17 to 66 from tafe_survey
.
#Dropping unecessary columns
tafe_survey_updated = tafe_survey.drop(tafe_survey.columns[17:66],axis =1)
old_columns = tafe_survey.shape[1]
new_columns= tafe_survey_updated.shape[1]
"tafe_sruvey had {} columns and now has {} columns".format(old_columns,new_columns)
'tafe_sruvey had 72 columns and now has 23 columns'
We want to be able to combine both data set for our analysis, therfore we will have to standardize the column names.
We will start by cleaning up the columns in dete_survey_updated
.
We are going to apply the following criteria:
dete_survey_updated.columns = dete_survey_updated.columns.str.lower().str.strip().str.replace(" ","_")
dete_survey_updated.columns# print the new names to ensure changes have been made
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')
To standardize the columns name, we will have to rename some of the tafe_survey_updated
columns.
#Dictionary with the new names
new_names = {'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'
}
tafe_survey_updated.rename(columns=new_names, inplace=True)
tafe_survey_updated.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')
In the steps above, we have renamed the columns that we will use in our analysis. Next, we will remove more of the data we don't need.
Our analysis is based on resignations only; separationtype
column of each dataset captures this information.
First, let's explore that column in each data set.
dete_survey_updated['separationtype'].value_counts()
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
Form the table above; we can see that in dete_survey_updated
there are three different instances of resignation; we will need to account for each of these.
Next, let's explore tafe_survey_udated
.
tafe_survey_updated['separationtype'].value_counts()
Resignation 340 Contract Expired 127 Retrenchment/ Redundancy 104 Retirement 82 Transfer 25 Termination 23 Name: separationtype, dtype: int64
In this case, there is only one instance of resignation.
In the next step, we will only select the rows of data for survey respondents who have a resignation separation type..
tafe_resignations = tafe_survey_updated[tafe_survey_updated['separationtype'] == "Resignation"].copy()
#Filter to include all options with Resignation
filtered = dete_survey_updated['separationtype'].str.contains("Resignation")
dete_resignations = dete_survey_updated[filtered].copy()
In the steps above, we have standardized some of the names of the columns and filtered the data set only to contain resignation data.
In the next step, we are going to ensure that the data does not contain any significant inconsistencies. We will focus on ensuring that the years in the dataset make sense.
We will start by analyzing the cease_date
columns in dete_resignations
.
dete_resignations['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/2012 1 07/2006 1 2010 1 09/2010 1 Name: cease_date, dtype: int64
As we can see, there are different date formats in the column cease_date
.
In the next step, we will extract the year information.
#extract the last 4 digits
dete_resignations['cease_date']=dete_resignations['cease_date'].str[-4:]
#Convet to float
dete_resignations['cease_date']=dete_resignations['cease_date'].astype(float)
dete_resignations['cease_date'].value_counts()
2013.0 146 2012.0 129 2014.0 22 2010.0 2 2006.0 1 Name: cease_date, dtype: int64
In the step above, we have successfully extracted the year information.
As we can see, the cease_date
ranges from 2006 to 2013.
Next, we will explore the data in dete_start_date
.
dete_resignations.boxplot(column = 'dete_start_date',grid= True)
<matplotlib.axes._subplots.AxesSubplot at 0x7f042b3b5828>
The Box plot above shows the spread of the value in dete_start_date
. We can see that there are some outliers, with staring dates before 1980.
In the next step, we will explore cease_date
column in tafe-resignations
tafe_resignations['cease_date'].value_counts()
2011.0 116 2012.0 94 2010.0 68 2013.0 55 2009.0 2 Name: cease_date, dtype: int64
We can see that the cease_date
ranges from 2009 to 2013.
From the steps above, we can conclude that there are no significant issues with the years. Therefore the data is logically consistent, and we can continue with the analysis.
One of the objectives of the analysis is to analyze differences by the years of service. The tafe_resignation
data frame already contains this data point in the institute_service
column. However, dete_resignations
does not provide this data point. Therefore, in the next step, we will add the institute_service
column in dete_resignations
.
#Adding institue_service column
dete_resignations['institute_service'] = dete_resignations['cease_date'] - dete_resignations['dete_start_date']
dete_resignations['institute_service'].value_counts().sort_index()
0.0 20 1.0 22 2.0 14 3.0 20 4.0 16 5.0 23 6.0 17 7.0 13 8.0 8 9.0 14 10.0 6 11.0 4 12.0 6 13.0 8 14.0 6 15.0 7 16.0 5 17.0 6 18.0 5 19.0 3 20.0 7 21.0 3 22.0 6 23.0 4 24.0 4 25.0 2 26.0 2 27.0 1 28.0 2 29.0 1 30.0 2 31.0 1 32.0 3 33.0 1 34.0 1 35.0 1 36.0 2 38.0 1 39.0 3 41.0 1 42.0 1 49.0 1 Name: institute_service, dtype: int64
In the step above, we have added the column institute_service
to dete_resignations
by substracting dete_start_date
from cease_date
.
Next, we will identify any employees who resigned because they were dissatisfied.
We will start with tafe_resignation
. Two columns indicate that the employee was unhappy:
Contribution Factors. Dissatisfaction
Contribution Factors. Job Dissatisfaction
In the next step, will examine the values in those two columns.
tafe_resignations['Contributing Factors. Dissatisfaction'].value_counts(dropna=False)
- 277 Contributing Factors. Dissatisfaction 55 NaN 8 Name: Contributing Factors. Dissatisfaction, dtype: int64
There are two values in Contributing Factors. Dissatisfaction
, either -
, indicated that resignation does not do to Dissatisfaction or Contributing Factors. Dissatisfaction
showing that this resignation is due to job dissatisfaction.
tafe_resignations['Contributing Factors. Job Dissatisfaction'].value_counts(dropna=False)
- 270 Job Dissatisfaction 62 NaN 8 Name: Contributing Factors. Job Dissatisfaction, dtype: int64
There are two values in Contributing Factors. Job Dissatisfaction
, either -
, indicated that resignation does not do to Dissatisfaction or Job Dissatisfaction
, indicating that this resignation is due to job dissatisfaction.
We will use the above information to update the values to either True, id resignation is due to job dissatisfaction, False if the data point is -
and NaN for unknown values.
#Defining a function to update the values to Boolean
def update_vals(element):
'''
This function takes a variable and return a boolean of NaN is the variable is NaN
The function returns False is the variable is equal to - and True otherwise.
'''
if pd.isnull(element):
result = np.nan
elif element is '-':
result = False
else:
result = True
return result
In the next step, we will use the function update_vals
to create a column dissatisfied
. This column will contain True
if the resignation is due to job Dissatisfaction, and False if not.
tafe_resignations['Contributing Factors. Job Dissatisfaction'] = tafe_resignations['Contributing Factors. Job Dissatisfaction'].apply(update_vals)
tafe_resignations['Contributing Factors. Dissatisfaction'] = tafe_resignations['Contributing Factors. Dissatisfaction'].apply(update_vals)
tafe_resignations['dissatisfaction'] = tafe_resignations[['Contributing Factors. Dissatisfaction','Contributing Factors. Job Dissatisfaction']].any(axis=1,skipna=False)
tafe_resignations_up= tafe_resignations.copy()
tafe_resignations_up['dissatisfaction'].value_counts(dropna=False)
False 241 True 91 NaN 8 Name: dissatisfaction, dtype: int64
In the step above, we have identified the resignation with disatisfaction for tafe_resignation
. Next, we will do the same for dete_resignation
.
In dete_resignation
there are 9 columns that indicate disatifaction:
job_dissatisfaction
dissatisfaction_with_the_department
-physical_work_environment
-lack_of_recognition
lack_of_job_security
work_location
employment_conditions
work_life_balance
workload
dete_disatisfaction = ['job_dissatisfaction','dissatisfaction_with_the_department',
'physical_work_environment',
'lack_of_recognition',
'lack_of_job_security',
'work_location',
'employment_conditions',
'work_life_balance',
'workload'
]
dete_resignations[dete_disatisfaction].head(5)
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 |
We can see that booleans values already represent the variable, therefore we can proceed to create the column disatisfaction
dete_resignations['dissatisfaction'] = dete_resignations[dete_disatisfaction].any(axis=1,skipna=False)
dete_resignations_up= dete_resignations.copy()
dete_resignations_up['dissatisfaction'].value_counts(dropna=False)
False 162 True 149 Name: dissatisfaction, dtype: int64
In the steps above, we have create a new column that indicates wheather an employee resigned becuase they were dissatisfied in some way.
In the next step, we will combine both datasets and remove the columns that we don't need for the analysis.
dete_resignations_up['institute'] = 'DETE'
tafe_resignations_up['institute'] = 'TAFE'
combined = pd.concat([dete_resignations_up,tafe_resignations_up],ignore_index=True)
combined.isnull().sum()
Contributing Factors. Career Move - Private Sector 319 Contributing Factors. Career Move - Public Sector 319 Contributing Factors. Career Move - Self-employment 319 Contributing Factors. Dissatisfaction 319 Contributing Factors. Ill Health 319 Contributing Factors. Interpersonal Conflict 319 Contributing Factors. Job Dissatisfaction 319 Contributing Factors. Maternity/Family 319 Contributing Factors. NONE 319 Contributing Factors. Other 319 Contributing Factors. Study 319 Contributing Factors. Travel 319 Institute 311 WorkArea 311 aboriginal 644 age 55 business_unit 619 career_move_to_private_sector 340 career_move_to_public_sector 340 cease_date 16 classification 490 dete_start_date 368 disability 643 dissatisfaction 8 dissatisfaction_with_the_department 340 employment_conditions 340 employment_status 54 gender 59 id 0 ill_health 340 institute 0 institute_service 88 interpersonal_conflicts 340 job_dissatisfaction 340 lack_of_job_security 340 lack_of_recognition 340 maternity/family 340 nesb 642 none_of_the_above 340 physical_work_environment 340 position 53 region 386 relocation 340 role_service 361 role_start_date 380 separationtype 0 south_sea 648 study/travel 340 torres_strait 651 traumatic_incident 340 work_life_balance 340 work_location 340 workload 340 dtype: int64
As we combine both datasets, we include all the columns that we have used in previous steps. As those columns were unique to each dataset, when combining the dataset, those columns will generate a high amount of null values.
Through the process of cleaning the data, we have standardized the columns that we will use for our analysis; therefore we can assume that any column containing less than 500 non-null values is not needed, and consequently, we will drop them.
combined_updated = combined.dropna(axis=1,thresh = 500)# we will drop colums with less than 500 non null values
combined_updated.isnull().sum()
age 55 cease_date 16 dissatisfaction 8 employment_status 54 gender 59 id 0 institute 0 institute_service 88 position 53 separationtype 0 dtype: int64
We have combined our data frames and removed the columns not needed for the analysis.
For our analysis, we are interested in the differences between recently hired employees and employees who have been in the job for a long time.
This information is in the column insitute_service
.
Let's explore the values in this column.
combined_updated['institute_service'].value_counts()
Less than 1 year 73 1-2 64 3-4 63 5-6 33 11-20 26 5.0 23 1.0 22 7-10 21 3.0 20 0.0 20 6.0 17 4.0 16 9.0 14 2.0 14 7.0 13 More than 20 years 10 13.0 8 8.0 8 20.0 7 15.0 7 14.0 6 17.0 6 12.0 6 10.0 6 22.0 6 18.0 5 16.0 5 24.0 4 23.0 4 11.0 4 19.0 3 39.0 3 21.0 3 32.0 3 25.0 2 26.0 2 36.0 2 28.0 2 30.0 2 42.0 1 49.0 1 35.0 1 34.0 1 31.0 1 33.0 1 29.0 1 27.0 1 41.0 1 38.0 1 Name: institute_service, dtype: int64
As we can see, there are different forms in which the employment time is defined. To analyze our data, we will create the below career stage definitions:
combined_updated = combined_updated.copy()
combined_updated['institute_service'] = combined_updated['institute_service'].astype(str)
#extract the digits from insitute _service and transform as float
combined_updated['institute_service'] = combined_updated['institute_service'].str.extract(r'(\d+)', expand=False).astype(float)
combined_updated['institute_service'].value_counts(dropna=False)
1.0 159 NaN 88 3.0 83 5.0 56 7.0 34 11.0 30 0.0 20 20.0 17 6.0 17 4.0 16 9.0 14 2.0 14 13.0 8 8.0 8 15.0 7 22.0 6 10.0 6 17.0 6 14.0 6 12.0 6 16.0 5 18.0 5 24.0 4 23.0 4 21.0 3 39.0 3 32.0 3 19.0 3 36.0 2 30.0 2 25.0 2 26.0 2 28.0 2 42.0 1 29.0 1 35.0 1 27.0 1 41.0 1 49.0 1 38.0 1 34.0 1 33.0 1 31.0 1 Name: institute_service, dtype: int64
In the step above, we have extracted the year's information. Next, we will map each value to one of the career stage definitions above.
def career_map(val):
'''
returns the corresponding career stage according to the number of years worked.
'''
if pd.isnull(val):
return np.nan
elif val <3:
return 'New'
elif val < 6:
return 'Experienced'
elif val<10:
return 'Established'
else:
return'Veteran'
The function above can be used to map the years of work to the career stage definition. Next, we will apply this function to create a new column service_cat
.
combined_updated['service_cat']= combined_updated['institute_service'].apply(career_map)
combined_updated['service_cat'].value_counts()
New 193 Experienced 155 Veteran 142 Established 73 Name: service_cat, dtype: int64
Above, we have created a service_cat
column that categorizes employees according to the number of years spent in their workplace.
For our analysis, we are interested in the difference between age groups.
Let's first explore the age
column.
combined_updated['age'].value_counts()
51-55 71 41-45 48 41 45 45 46-50 42 36-40 41 46 50 39 26-30 35 21 25 33 31 35 32 26 30 32 36 40 32 31-35 29 21-25 29 56 or older 29 56-60 26 61 or older 23 20 or younger 10 Name: age, dtype: int64
As we can see, there are different formats. All the bins seem to go in 4-year increments. However, some are separated by double space and others by -
. Moreover, 3 categories are indicating 56 or older employees.
In the next step, we will fix the bins so that they all look as 21-25 and we will rename all the categories of age 56 and above as 56 or older
.
combined_updated = combined_updated.copy()
combined_updated["age"]=combined_updated["age"].str.replace(" ","-").str.replace("56-60",'56 or older').str.replace('61 or older','56 or older')
combined_updated["age"].value_counts()
41-45 93 46-50 81 56 or older 78 36-40 73 51-55 71 26-30 67 21-25 62 31-35 61 20 or younger 10 Name: age, dtype: int64
In the steps above we have cleaned the data for our analysis
The first question we are trying to answer is wheater or not, employees who only worked for the institutes for a short period resigning due to some dissatisfaction, and is there a difference across years of service.
combined_updated['dissatisfaction'].value_counts(dropna = False)
False 403 True 240 NaN 8 Name: dissatisfaction, dtype: int64
As we can see, the most common value in this column is False; we can also see that there are 8 null values. We will replace those null values with False
.
combined_updated['dissatisfaction']= combined_updated['dissatisfaction'].fillna(value= False)
combined_updated['dissatisfaction'].value_counts(dropna = False)
False 411 True 240 Name: dissatisfaction, dtype: int64
In the next step, we will analyze the % of dissatisfied employees in each service_cat
group.
service_cat_pivot= combined_updated.pivot_table(index ='service_cat',values='dissatisfaction')
service_cat_pivot.plot(kind='bar',title='Percantage of resignations due to dissatisfcation ', legend =False)
<matplotlib.axes._subplots.AxesSubplot at 0x7f042b35b978>
The bar plot above shows the percentage os resignation due to job dissatisfaction across different career stages.
30%of the resignations from new and experienced employees are due to job dissatisfaction, whereas over 55% of the Established employees resign due to job dissatisfaction.
Therefore we can say that recently hired employees tend to resign for reasons others than job dissatisfaction, whereas Established employees tend to leave due to job dissatisfaction.
The second question of our analysis is to see if young employees are resigning due to job dissatisfaction and if there is any difference across age groups.
age_pivot= combined_updated.pivot_table(index ='age',values='dissatisfaction')
age_pivot.plot(kind='bar',title='Percantage of resignations due to dissatisfcation ', legend =False)
<matplotlib.axes._subplots.AxesSubplot at 0x7f0429280cc0>
The bar plot above shows the percentage of resignations due to dissatisfaction across different age groups.
The younger group, from less than 20 to 25, resigns 20 to 30% of time due to job dissatisfaction. Whereas for all other groups, the resignation due to dissatisfaction range from 35% to 43%.
Resignations due to dissatisfaction across ages range from 35% to 43%, except with younger employees, for which it varies from 20% to 30%. There is no significant difference across age groups, which suggests that the age of the employee does not impact the number of resignations due to job dissatisfaction.
On the other hand, over 55% of the Established employees resign due to job dissatisfaction, whereas only 30% of the resignations from new and experienced employees are due to job dissatisfaction. This suggests that years spend at the workplace has an impact on job dissatisfaction resignations, with employees with 7 to 10 years resigning more often due to job dissatisfaction.