In this project, we'll 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. You can find the TAFE exit survey here and the survey for the DETE here.
In this project, we'll play the role of data analyst and our stakeholders would like to know the following:
As a result of our analysis, the following conclusions have been reached:
A data dictionary wasn't provided with the dataset. 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
:
ID
: An id used to identify the participant of the surveySeparationType
: The reason why the person's employment endedCease Date
: The year or month the person's employment endedDETE Start Date
: The year the person began employment with the DETEBelow is a preview of a couple columns we'll work with from the tafe_survey.csv
:
Record ID
: An id used to identify the participant of the surveyReason for ceasing employment
: The reason why the person's employment endedLengthofServiceOverall
. Overall Length of Service at Institute (in years): The length of the person's employment (in years)Let's start by reading the datasets into pandas and exploring them.
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
plt.style.use('seaborn')
dete_survey
dataset¶dete_survey = pd.read_csv('dete_survey.csv')
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
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
def missing_perc(df):
'''Prin the percentage of missing data in descending order'''
return round(df.isnull().sum()/df.shape[0]*100, 2).sort_values(ascending=False)
missing_perc(dete_survey)
Torres Strait 99.64 South Sea 99.15 Aboriginal 98.05 Disability 97.20 NESB 96.11 Business Unit 84.67 Classification 44.65 Opportunities for promotion 10.58 Career Aspirations 9.25 Wellness programs 6.81 Coach 6.69 Further PD 6.57 Workplace issue 4.14 Feedback 3.65 Health & Safety 3.53 Gender 2.92 Professional Development 1.70 Stress and pressure support 1.46 Skills 1.34 Age 1.34 Peer support 1.22 My say 1.22 Performance of supervisor 1.09 Initiative 1.09 Kept informed 1.09 Communication 0.97 Worklife balance 0.85 Staff morale 0.73 Information 0.73 Physical environment 0.61 Employment Status 0.61 Position 0.61 Region 0.00 Career move to private sector 0.00 Career move to public sector 0.00 Role Start Date 0.00 DETE Start Date 0.00 Cease Date 0.00 SeparationType 0.00 Job dissatisfaction 0.00 Interpersonal conflicts 0.00 None of the above 0.00 Dissatisfaction with the department 0.00 Physical work environment 0.00 Lack of recognition 0.00 Lack of job security 0.00 Work location 0.00 Employment conditions 0.00 Maternity/family 0.00 Relocation 0.00 Study/Travel 0.00 Ill Health 0.00 Traumatic incident 0.00 Work life balance 0.00 Workload 0.00 ID 0.00 dtype: float64
# Discover columns with big percentage of missing values
dete_survey['Business Unit'].value_counts(dropna=False)
NaN 696 Education Queensland 54 Information and Technologies 26 Training and Tertiary Education Queensland 12 Other 11 Human Resources 6 Corporate Strategy and Peformance 5 Early Childhood Education and Care 3 Infrastructure 2 Policy, Research, Legislation 2 Indigenous Education and Training Futures 1 Pacific Pines SHS 1 Corporate Procurement 1 Calliope State School 1 Finance 1 Name: Business Unit, dtype: int64
dete_survey['Classification'].value_counts(dropna=False)
NaN 367 Primary 161 Secondary 124 A01-A04 66 AO5-AO7 46 Special Education 33 AO8 and Above 14 PO1-PO4 8 Middle 3 Name: Classification, dtype: int64
dete_survey['Aboriginal'].value_counts(dropna=False)
NaN 806 Yes 16 Name: Aboriginal, dtype: int64
dete_survey.describe(include='all')
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 | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
count | 822.000000 | 822 | 822 | 822 | 822 | 817 | 455 | 822 | 126 | 817 | ... | 813 | 766 | 793 | 798 | 811 | 16 | 3 | 7 | 23 | 32 |
unique | NaN | 9 | 25 | 51 | 46 | 15 | 8 | 9 | 14 | 5 | ... | 6 | 6 | 6 | 2 | 10 | 1 | 1 | 1 | 1 | 1 |
top | NaN | Age Retirement | 2012 | Not Stated | Not Stated | Teacher | Primary | Metropolitan | Education Queensland | Permanent Full-time | ... | A | A | A | Female | 61 or older | Yes | Yes | Yes | Yes | Yes |
freq | NaN | 285 | 344 | 73 | 98 | 324 | 161 | 135 | 54 | 434 | ... | 401 | 253 | 386 | 573 | 222 | 16 | 3 | 7 | 23 | 32 |
mean | 411.693431 | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | ... | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN |
std | 237.705820 | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | ... | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN |
min | 1.000000 | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | ... | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN |
25% | 206.250000 | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | ... | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN |
50% | 411.500000 | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | ... | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN |
75% | 616.750000 | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | ... | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN |
max | 823.000000 | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | ... | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN |
11 rows × 56 columns
Following observations can be done based on preliminary exploration of dete_survey
dataset:
ID
are either object(string) or bool type.Business Unit
and Classification
columns.NaN
basically means No
.Not Stated
is the most common value, but it is not represented as NaN
.tafe_survey
dataset¶tafe_survey = pd.read_csv('tafe_survey.csv')
tafe_survey.head()
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
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
# Display missing values percentage for all the columns
pd.set_option('display.max_rows', 72)
missing_perc(tafe_survey)
Main Factor. Which of these was the main factor for leaving? 83.90 InductionInfo. Topic:Did you undertake a Corporate Induction? 38.46 Contributing Factors. Ill Health 37.75 Contributing Factors. Maternity/Family 37.75 Contributing Factors. Career Move - Public Sector 37.75 Contributing Factors. NONE 37.75 Contributing Factors. Other 37.75 Contributing Factors. Dissatisfaction 37.75 Contributing Factors. Career Move - Self-employment 37.75 Contributing Factors. Career Move - Private Sector 37.75 Contributing Factors. Travel 37.75 Contributing Factors. Study 37.75 Contributing Factors. Interpersonal Conflict 37.75 Contributing Factors. Job Dissatisfaction 37.75 InductionInfo. Topic: Did you undertake Team Induction? 37.32 InductionInfo. Topic:Did you undertake a Institute Induction? 31.20 InductionInfo. Face to Face Topic:Did you undertake a Institute Induction? 24.50 InductionInfo. Induction Manual Topic:Did you undertake a Institute Induction? 21.23 InductionInfo. Face to Face Topic:Did you undertake a Corporate Induction; Category:How it was conducted? 20.94 InductionInfo. On-line Topic:Did you undertake a Institute Induction? 20.94 InductionInfo. On-line Topic:Did you undertake a Corporate Induction; Category:How it was conducted? 20.94 InductionInfo. Induction Manual Topic:Did you undertake a Corporate Induction? 20.94 InductionInfo. Face to Face Topic: Did you undertake Team Induction; Category? 20.94 InductionInfo. On-line Topic: Did you undertake Team Induction?process you undertook and how it was conducted.] 20.94 InductionInfo. Induction Manual Topic: Did you undertake Team Induction? 20.94 Workplace. Topic:Would you recommend the Institute as an employer to others? 17.24 Workplace. Topic:Does your workplace value the diversity of its employees? 16.52 Workplace. Topic:Does your workplace promote and practice the principles of employment equity? 16.38 Workplace. Topic:Does your workplace promote a work culture free from all forms of unlawful discrimination? 15.38 LengthofServiceOverall. Overall Length of Service at Institute (in years) 15.10 LengthofServiceCurrent. Length of Service at current workplace (in years) 15.10 Gender. What is your Gender? 15.10 CurrentAge. Current Age 15.10 Classification. Classification 15.10 Employment Type. Employment Type 15.10 InstituteViews. Topic:12. If I had a workplace issue it was dealt with efficiently 14.96 InstituteViews. Topic:11. If I had a workplace issue it was dealt with quickly 14.39 InstituteViews. Topic:13. If I had a workplace issue it was dealt with discreetly 14.39 InstituteViews. Topic:10. Staff morale was positive within the Institute 14.25 WorkUnitViews. Topic:29. There was adequate communication between staff in my unit 14.10 WorkUnitViews. Topic:15. I worked well with my colleagues 13.82 WorkUnitViews. Topic:30. Staff morale was positive within my work unit 13.68 WorkUnitViews. Topic:26. My supervisor gave me adequate personal recognition and feedback on my performance 13.68 WorkUnitViews. Topic:16. My job was challenging and interesting 13.53 InstituteViews. Topic:6. The organisation recognised when staff did good work 13.53 WorkUnitViews. Topic:22. I was able to use the full range of my knowledge in my job 13.39 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] 13.39 InstituteViews. Topic:4. I was given adequate opportunities for promotion within %Institute]Q25LBL% 13.39 Workplace. Topic:Did you and your Manager develop a Performance and Professional Development Plan (PPDP)? 13.39 InstituteViews. Topic:1. I feel the senior leadership had a clear vision and direction 13.39 InstituteViews. Topic:8. Management was generally supportive of my team 13.39 WorkUnitViews. Topic:14. I was satisfied with the quality of the management and supervision within my work unit 13.25 WorkUnitViews. Topic:19. I was given adequate support and co-operation by my peers to enable me to do my job 13.25 WorkUnitViews. Topic:20. I was able to use the full range of my skills in my job 13.25 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 13.25 WorkUnitViews. Topic:24. I was able to cope with the level of stress and pressure in my job 13.11 InstituteViews. Topic:3. I was given adequate opportunities for personal development 13.11 WorkUnitViews. Topic:27. My working environment was satisfactory e.g. sufficient space, good lighting, suitable seating and working area 13.11 InstituteViews. Topic:9. I was kept informed of the changes in the organisation which would affect me 13.11 WorkUnitViews. Topic:17. I was encouraged to use my initiative in the course of my work 13.11 WorkUnitViews. Topic:25. My job allowed me to balance the demands of work and family to my satisfaction 12.96 WorkUnitViews. Topic:23. My job provided sufficient variety 12.96 WorkUnitViews. Topic:18. I had sufficient contact with other people in my job 12.68 InstituteViews. Topic:2. I was given access to skills training to help me do my job better 12.68 InstituteViews. Topic:7. Management was generally supportive of me 12.54 InstituteViews. Topic:5. I felt the salary for the job was right for the responsibilities I had 12.39 Induction. Did you undertake Workplace Induction? 11.82 CESSATION YEAR 1.00 Reason for ceasing employment 0.14 WorkArea 0.00 Institute 0.00 Record ID 0.00 dtype: float64
tafe_survey['Main Factor. Which of these was the main factor for leaving?'].value_counts(dropna=False)
NaN 589 Dissatisfaction with %[Institute]Q25LBL% 23 Job Dissatisfaction 22 Other 18 Career Move - Private Sector 16 Interpersonal Conflict 9 Career Move - Public Sector 8 Maternity/Family 6 Career Move - Self-employment 4 Ill Health 3 Study 2 Travel 2 Name: Main Factor. Which of these was the main factor for leaving?, dtype: int64
tafe_survey['InductionInfo. Topic:Did you undertake a Corporate Induction?'].value_counts(dropna=False)
NaN 270 Yes 232 No 200 Name: InductionInfo. Topic:Did you undertake a Corporate Induction?, dtype: int64
# Display all the columns
pd.set_option('display.max_columns', 72)
tafe_survey.describe(include='all')
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 | Contributing Factors. Dissatisfaction | Contributing Factors. Job Dissatisfaction | Contributing Factors. Interpersonal Conflict | Contributing Factors. Study | Contributing Factors. Travel | Contributing Factors. Other | Contributing Factors. NONE | 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? | 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) | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
count | 7.020000e+02 | 702 | 702 | 695.000000 | 701 | 437 | 437 | 437 | 437 | 437 | 437 | 437 | 437 | 437 | 437 | 437 | 437 | 113 | 608 | 613 | 610 | 608 | 615 | 607 | 614 | 608 | 610 | 602 | 601 | 597 | 601 | 609 | 605 | 607 | 610 | 613 | 609 | 609 | 608 | 608 | 611 | 610 | 611 | 606 | 610 | 609 | 603 | 606 | 619 | 432 | 483 | 440 | 555 | 555 | 555 | 530 | 555 | 553 | 555 | 555 | 555 | 608 | 594 | 587 | 586 | 581 | 596 | 596 | 596 | 596 | 596 | 596 |
unique | NaN | 12 | 2 | NaN | 6 | 2 | 2 | 2 | 2 | 2 | 2 | 2 | 2 | 2 | 2 | 2 | 2 | 11 | 6 | 6 | 6 | 6 | 6 | 6 | 6 | 6 | 6 | 6 | 6 | 6 | 6 | 6 | 6 | 6 | 6 | 6 | 6 | 6 | 6 | 6 | 6 | 6 | 6 | 6 | 6 | 6 | 6 | 6 | 2 | 2 | 2 | 2 | 2 | 2 | 2 | 2 | 2 | 2 | 2 | 1 | 2 | 2 | 2 | 2 | 2 | 2 | 2 | 9 | 5 | 9 | 7 | 7 |
top | NaN | Brisbane North Institute of TAFE | Non-Delivery (corporate) | NaN | Resignation | - | - | - | - | - | - | - | - | - | - | - | - | Dissatisfaction with %[Institute]Q25LBL% | Agree | Agree | Agree | Neutral | Agree | Agree | Agree | Agree | Agree | Neutral | Agree | Agree | Agree | Agree | Agree | Agree | Agree | Agree | Agree | Agree | Agree | Agree | Agree | Agree | Agree | Agree | Agree | Agree | Agree | Agree | Yes | Yes | Yes | Yes | - | - | - | - | - | - | - | - | - | Yes | Yes | Yes | Yes | Yes | Female | 56 or older | Permanent Full-time | Administration (AO) | Less than 1 year | Less than 1 year |
freq | NaN | 161 | 432 | NaN | 340 | 375 | 336 | 420 | 403 | 411 | 371 | 360 | 410 | 421 | 415 | 331 | 391 | 23 | 233 | 275 | 247 | 175 | 255 | 212 | 267 | 268 | 284 | 154 | 216 | 209 | 226 | 234 | 281 | 284 | 253 | 331 | 286 | 230 | 232 | 237 | 296 | 298 | 290 | 231 | 269 | 234 | 300 | 236 | 541 | 232 | 441 | 285 | 412 | 502 | 539 | 270 | 473 | 518 | 366 | 555 | 541 | 382 | 536 | 512 | 488 | 416 | 389 | 162 | 237 | 293 | 147 | 177 |
mean | 6.346026e+17 | NaN | NaN | 2011.423022 | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN |
std | 2.515071e+14 | NaN | NaN | 0.905977 | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN |
min | 6.341330e+17 | NaN | NaN | 2009.000000 | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN |
25% | 6.343954e+17 | NaN | NaN | 2011.000000 | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN |
50% | 6.345835e+17 | NaN | NaN | 2011.000000 | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN |
75% | 6.348005e+17 | NaN | NaN | 2012.000000 | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN |
max | 6.350730e+17 | NaN | NaN | 2013.000000 | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN |
# Explore one of the columns with "-" as a most common value
tafe_survey['Contributing Factors. Career Move - Self-employment'].value_counts(dropna=False)
- 420 NaN 265 Career Move - Self-employment 17 Name: Contributing Factors. Career Move - Self-employment, dtype: int64
Following observations can be done based on preliminary exploration of tafe_survey
dataset:
ID
and CESSATION YEAR
are object(string) type.Main Factor. Which of these was the main factor for leaving?
. In lots of other columns missing value percantage varies from 15% to 40%.dete_survey.
Therefore, data cleaning demand could be higher here.-
not as missing value, since it can be an answer to the binary question.# Treat 'Not Stated' as a missing value.
dete_survey = pd.read_csv('dete_survey.csv', na_values='Not Stated')
# Check the result
dete_survey.describe(include='all')
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 | 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 | Gender | Age | Aboriginal | Torres Strait | South Sea | Disability | NESB | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
count | 822.000000 | 822 | 788 | 749.000000 | 724.000000 | 817 | 455 | 717 | 126 | 817 | 822 | 822 | 822 | 822 | 822 | 822 | 822 | 822 | 822 | 822 | 822 | 822 | 822 | 822 | 822 | 822 | 822 | 822 | 808 | 735 | 816 | 788 | 817 | 815 | 810 | 813 | 812 | 813 | 811 | 767 | 746 | 792 | 768 | 814 | 812 | 816 | 813 | 766 | 793 | 798 | 811 | 16 | 3 | 7 | 23 | 32 |
unique | NaN | 9 | 24 | NaN | NaN | 15 | 8 | 8 | 14 | 5 | 2 | 2 | 2 | 2 | 2 | 2 | 2 | 2 | 2 | 2 | 2 | 2 | 2 | 2 | 2 | 2 | 2 | 2 | 6 | 6 | 6 | 6 | 6 | 6 | 6 | 6 | 6 | 6 | 6 | 6 | 6 | 6 | 6 | 6 | 6 | 6 | 6 | 6 | 6 | 2 | 10 | 1 | 1 | 1 | 1 | 1 |
top | NaN | Age Retirement | 2012 | NaN | NaN | Teacher | Primary | Metropolitan | Education Queensland | Permanent Full-time | False | False | False | False | False | False | False | False | False | False | False | False | False | False | False | False | False | False | A | A | A | A | A | A | A | A | A | A | A | A | A | A | A | A | A | A | A | A | A | Female | 61 or older | Yes | Yes | Yes | Yes | Yes |
freq | NaN | 285 | 344 | NaN | NaN | 324 | 161 | 135 | 54 | 434 | 800 | 742 | 788 | 733 | 761 | 806 | 765 | 794 | 795 | 788 | 760 | 754 | 785 | 710 | 794 | 605 | 735 | 605 | 413 | 242 | 335 | 357 | 467 | 359 | 342 | 349 | 401 | 396 | 372 | 345 | 246 | 348 | 293 | 399 | 400 | 436 | 401 | 253 | 386 | 573 | 222 | 16 | 3 | 7 | 23 | 32 |
mean | 411.693431 | NaN | NaN | 1994.182911 | 1998.955801 | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN |
std | 237.705820 | NaN | NaN | 13.880503 | 67.792281 | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN |
min | 1.000000 | NaN | NaN | 1963.000000 | 200.000000 | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN |
25% | 206.250000 | NaN | NaN | 1982.000000 | 1995.000000 | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN |
50% | 411.500000 | NaN | NaN | 1996.000000 | 2005.000000 | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN |
75% | 616.750000 | NaN | NaN | 2007.000000 | 2010.000000 | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN |
max | 823.000000 | NaN | NaN | 2013.000000 | 2013.000000 | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN |
Since out goal is to evaluate the reason to resignation for the employees, there are a lot of reduntant columns in both datasets. Let's get rid of them.
From dete_survey
we drop columns from 28 Professional development
to 48 Health & Safety
. The reason for this is that bool type columns up to Professional development
describing the reasons for resignation.
From tafe_survey
we'll drop columns 17 to 66, since all contributing factors are located before column 17.
dete_survey_updated = dete_survey.drop(dete_survey.columns[28:49], axis=1)
dete_survey_updated.head()
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 | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | 1 | Ill Health Retirement | 08/2012 | 1984.0 | 2004.0 | Public Servant | A01-A04 | Central Office | Corporate Strategy and Peformance | Permanent Full-time | True | False | False | True | False | False | True | False | False | False | False | False | False | False | False | False | False | True | 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 | False | False | False | False | False | False | False | False | False | False | False | False | False | False | False | False | False | False | 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 | False | False | False | False | False | False | False | False | False | False | False | False | False | False | False | False | False | True | 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 | False | True | False | False | False | False | False | False | False | False | False | False | False | False | False | False | False | False | 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 | False | False | False | False | False | False | False | False | False | False | False | False | False | False | False | True | False | False | Female | 61 or older | NaN | NaN | NaN | NaN | NaN |
tafe_survey_updated = tafe_survey.drop(tafe_survey.columns[17:66], axis=1)
tafe_survey_updated.head()
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 | Contributing Factors. Dissatisfaction | Contributing Factors. Job Dissatisfaction | Contributing Factors. Interpersonal Conflict | Contributing Factors. Study | Contributing Factors. Travel | Contributing Factors. Other | Contributing Factors. NONE | 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 | NaN | NaN | NaN | NaN | NaN | NaN | NaN | 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 | - | - | - | - | - | - | - | - | - | Travel | - | - | NaN | NaN | NaN | NaN | NaN | NaN |
2 | 6.341388e+17 | Mount Isa Institute of TAFE | Delivery (teaching) | 2010.0 | Retirement | - | - | - | - | - | - | - | - | - | - | - | NONE | NaN | NaN | NaN | NaN | NaN | NaN |
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 |
Since we want to eventually unite dete_survey
and tafe_survey
for our analysis, let's rename columns in both datasets to prepare them for merging.
dete_survey_updated.columns = dete_survey_updated.columns.str.replace(' ', '_').str.strip().str.lower()
dete_survey_updated.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')
tafe_survey_updated.rename(
{'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'},
axis=1, 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')
# Find all the reasons for ceasing a job indicating by employees
dete_survey_updated['separationtype'].unique()
array(['Ill Health Retirement', 'Voluntary Early Retirement (VER)', 'Resignation-Other reasons', 'Age Retirement', 'Resignation-Other employer', 'Resignation-Move overseas/interstate', 'Other', 'Contract Expired', 'Termination'], dtype=object)
tafe_survey_updated['separationtype'].unique()
array(['Contract Expired', 'Retirement', 'Resignation', 'Retrenchment/ Redundancy', 'Termination', 'Transfer', nan], dtype=object)
We will concentrate only on Resignation
in our analysis, since it indicates that empolyee left a job for another one deliberately.
dete_resignations = dete_survey_updated[(dete_survey_updated['separationtype'] == 'Resignation-Other reasons') |
(dete_survey_updated['separationtype'] == 'Resignation-Other employer') |
(dete_survey_updated['separationtype'] == 'Resignation-Move overseas/interstate')].copy()
dete_resignations.head()
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 | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
3 | 4 | Resignation-Other reasons | 05/2012 | 2005.0 | 2006.0 | Teacher | Primary | Central Queensland | NaN | Permanent Full-time | False | True | False | False | False | False | False | False | False | False | False | False | False | False | False | 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 | True | False | False | False | False | False | False | False | True | True | False | False | False | False | 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 | True | False | False | False | False | False | False | False | False | False | False | False | False | False | 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 | True | True | True | False | False | False | False | False | False | False | False | False | False | 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 | False | False | False | False | False | False | False | True | True | False | False | False | False | False | False | Male | 31-35 | NaN | NaN | NaN | NaN | NaN |
tafe_resignations = tafe_survey_updated[tafe_survey_updated['separationtype'] == 'Resignation'].copy()
tafe_resignations.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. 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 | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
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 |
Let's combine 3 Resignation types in date_resignations
in 1 with a simple name Resignation
to align it with tafe_resignations
way of representation.
dete_resignations['separationtype'] = dete_resignations['separationtype'].str.split('-').str[0]
dete_resignations.head()
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 | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
3 | 4 | Resignation | 05/2012 | 2005.0 | 2006.0 | Teacher | Primary | Central Queensland | NaN | Permanent Full-time | False | True | False | False | False | False | False | False | False | False | False | False | False | False | False | False | False | False | Female | 36-40 | NaN | NaN | NaN | NaN | NaN |
5 | 6 | Resignation | 05/2012 | 1994.0 | 1997.0 | Guidance Officer | NaN | Central Office | Education Queensland | Permanent Full-time | False | True | False | False | False | False | False | False | False | True | True | False | False | False | False | False | False | False | Female | 41-45 | NaN | NaN | NaN | NaN | NaN |
8 | 9 | Resignation | 07/2012 | 2009.0 | 2009.0 | Teacher | Secondary | North Queensland | NaN | Permanent Full-time | False | True | False | False | False | False | False | False | False | False | False | False | False | False | False | False | False | False | Female | 31-35 | NaN | NaN | NaN | NaN | NaN |
9 | 10 | Resignation | 2012 | 1997.0 | 2008.0 | Teacher Aide | NaN | NaN | NaN | Permanent Part-time | False | False | True | True | True | False | False | False | False | False | False | False | False | False | False | False | False | False | Female | 46-50 | NaN | NaN | NaN | NaN | NaN |
11 | 12 | Resignation | 2012 | 2009.0 | 2009.0 | Teacher | Secondary | Far North Queensland | NaN | Permanent Full-time | False | False | False | False | False | False | False | False | False | False | True | True | False | False | False | False | False | False | Male | 31-35 | NaN | NaN | NaN | NaN | NaN |
Let's verify that cease_date
, dete_start_date
and role_start_date
columns make sense.
dete_resignations['cease_date'].value_counts(dropna=False)
2012 126 2013 74 01/2014 22 12/2013 17 06/2013 14 NaN 11 09/2013 11 11/2013 9 07/2013 9 10/2013 6 08/2013 4 05/2012 2 05/2013 2 07/2006 1 2010 1 07/2012 1 09/2010 1 Name: cease_date, dtype: int64
# Identify rows where cease-date is NaN
cease_date_null = dete_resignations[dete_resignations['cease_date'].isnull()]
cease_date_null
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 | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
683 | 685 | Resignation | NaN | 2011.0 | 2012.0 | Teacher | Primary | Central Queensland | NaN | Permanent Full-time | False | True | False | False | False | False | True | False | True | False | False | False | False | False | False | False | False | False | Male | 21-25 | NaN | NaN | NaN | NaN | NaN |
694 | 696 | Resignation | NaN | 2012.0 | NaN | Teacher Aide | NaN | Metropolitan | NaN | Casual | False | False | False | False | False | False | False | False | False | False | True | False | False | False | False | False | False | False | Female | 46-50 | NaN | NaN | NaN | NaN | NaN |
704 | 706 | Resignation | NaN | 2006.0 | 2007.0 | Teacher Aide | NaN | Darling Downs South West | NaN | Permanent Full-time | False | False | False | False | False | False | False | False | False | False | False | True | True | False | False | False | False | False | Female | 41-45 | NaN | NaN | NaN | NaN | NaN |
709 | 711 | Resignation | NaN | NaN | NaN | Teacher | Primary | Central Office | Education Queensland | Permanent Full-time | False | True | False | False | False | False | False | False | False | False | False | False | False | False | False | True | True | False | Female | 51-55 | NaN | NaN | NaN | NaN | NaN |
724 | 726 | Resignation | NaN | 1984.0 | NaN | Teacher | Primary | Darling Downs South West | NaN | Permanent Full-time | False | False | False | False | False | False | False | False | False | False | False | False | True | False | False | False | False | False | Female | 46-50 | NaN | NaN | NaN | NaN | NaN |
770 | 772 | Resignation | NaN | 1987.0 | 1987.0 | Cleaner | NaN | Darling Downs South West | NaN | Permanent Part-time | False | False | False | False | False | False | False | False | False | False | False | False | False | False | False | False | False | True | Female | 61 or older | NaN | NaN | NaN | NaN | NaN |
774 | 776 | Resignation | NaN | 2005.0 | 2005.0 | Teacher Aide | NaN | Central Queensland | NaN | Permanent Part-time | False | False | False | False | False | False | False | False | False | False | False | False | False | False | False | False | False | True | Female | 41-45 | NaN | NaN | NaN | NaN | NaN |
788 | 790 | Resignation | NaN | 1990.0 | 2010.0 | Teacher | Secondary | Metropolitan | NaN | Permanent Full-time | False | True | False | False | False | False | False | False | False | False | False | False | False | False | False | False | False | False | Female | 41-45 | NaN | NaN | NaN | NaN | NaN |
791 | 793 | Resignation | NaN | 2007.0 | 2007.0 | Public Servant | A01-A04 | Metropolitan | NaN | Permanent Part-time | False | False | False | False | False | False | True | False | False | False | False | False | False | False | False | False | False | False | Female | 46-50 | NaN | NaN | NaN | NaN | NaN |
797 | 799 | Resignation | NaN | 2000.0 | 2013.0 | Public Servant | A01-A04 | South East | NaN | Permanent Part-time | False | False | False | False | False | False | False | False | False | False | True | True | False | False | False | False | False | False | Female | 36-40 | NaN | NaN | NaN | NaN | NaN |
798 | 800 | Resignation | NaN | 1995.0 | NaN | Teacher Aide | NaN | Darling Downs South West | NaN | Permanent Part-time | False | False | False | False | False | False | False | False | False | False | False | False | False | False | False | False | False | False | Female | 36-40 | NaN | NaN | NaN | NaN | NaN |
# Drop these rows
dete_resignations.drop(cease_date_null.index, inplace=True)
dete_resignations['cease_date'].value_counts(dropna=False)
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/2013 2 05/2012 2 07/2006 1 2010 1 07/2012 1 09/2010 1 Name: cease_date, dtype: int64
# Use regular expression to delete a month indication
dete_resignations['cease_date'] = dete_resignations['cease_date'].str.replace(r'\d+/', '').astype(float)
dete_resignations['cease_date'].value_counts().sort_index()
2006.0 1 2010.0 2 2012.0 129 2013.0 146 2014.0 22 Name: cease_date, dtype: int64
dete_resignations['dete_start_date'].value_counts(dropna=False)
NaN 27 2011.0 23 2008.0 22 2007.0 20 2012.0 20 2010.0 17 2005.0 14 2004.0 14 2009.0 13 2006.0 12 2013.0 10 1999.0 8 2000.0 8 1998.0 6 2002.0 6 1994.0 6 1992.0 6 1996.0 6 2003.0 6 1980.0 5 1993.0 5 1997.0 5 1991.0 4 1990.0 4 1988.0 4 1989.0 4 2001.0 3 1995.0 3 1986.0 3 1985.0 3 1976.0 2 1983.0 2 1974.0 2 1963.0 1 1972.0 1 1975.0 1 1973.0 1 1982.0 1 1971.0 1 1977.0 1 Name: dete_start_date, dtype: int64
# Drop rows with Nan values
dete_resignations.drop(dete_resignations[dete_resignations['dete_start_date'].isnull()].index, inplace=True)
# Check
dete_resignations['dete_start_date'].value_counts(dropna=False)
2011.0 23 2008.0 22 2007.0 20 2012.0 20 2010.0 17 2005.0 14 2004.0 14 2009.0 13 2006.0 12 2013.0 10 2000.0 8 1999.0 8 1996.0 6 2002.0 6 1998.0 6 2003.0 6 1992.0 6 1994.0 6 1997.0 5 1993.0 5 1980.0 5 1991.0 4 1989.0 4 1990.0 4 1988.0 4 2001.0 3 1986.0 3 1985.0 3 1995.0 3 1976.0 2 1974.0 2 1983.0 2 1971.0 1 1972.0 1 1982.0 1 1975.0 1 1973.0 1 1977.0 1 1963.0 1 Name: dete_start_date, dtype: int64
dete_resignations['role_start_date'].value_counts().sort_index()
200.0 1 1976.0 2 1980.0 1 1982.0 1 1986.0 1 1987.0 1 1988.0 3 1989.0 5 1990.0 1 1991.0 1 1992.0 4 1993.0 3 1994.0 2 1996.0 3 1997.0 5 1998.0 4 1999.0 6 2000.0 1 2001.0 2 2002.0 7 2003.0 6 2004.0 10 2005.0 8 2006.0 7 2007.0 22 2008.0 21 2009.0 18 2010.0 26 2011.0 32 2012.0 36 2013.0 23 Name: role_start_date, dtype: int64
# Find a row where role date is equal to 200
role_date_200 = dete_resignations[dete_resignations['role_start_date'] == 200]
role_date_200
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 | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
390 | 391 | Resignation | 2013.0 | 2000.0 | 200.0 | Teacher | Secondary | Central Queensland | NaN | Permanent Full-time | False | True | False | False | False | False | False | False | False | False | False | False | False | False | False | False | False | False | Female | 46-50 | NaN | NaN | NaN | NaN | NaN |
Since role_start_date
can be higher than dete_start_date
, we are not sure about the exact year to put instead of 200 here. So, let's better just drop this row.
# Drop by index indicated above
dete_resignations.drop(role_date_200.index, inplace=True)
# Check
dete_resignations['role_start_date'].value_counts()
2012.0 36 2011.0 32 2010.0 26 2013.0 23 2007.0 22 2008.0 21 2009.0 18 2004.0 10 2005.0 8 2006.0 7 2002.0 7 2003.0 6 1999.0 6 1989.0 5 1997.0 5 1992.0 4 1998.0 4 1993.0 3 1996.0 3 1988.0 3 2001.0 2 1994.0 2 1976.0 2 1991.0 1 1990.0 1 1982.0 1 1987.0 1 2000.0 1 1980.0 1 1986.0 1 Name: role_start_date, dtype: int64
dete_resignations[['dete_start_date','cease_date']].plot(kind='box', title='Start and cease dates')
<AxesSubplot:title={'center':'Start and cease dates'}>
tafe_resignations['cease_date'].value_counts(dropna=False).sort_index()
2009.0 2 2010.0 68 2011.0 116 2012.0 94 2013.0 55 NaN 5 Name: cease_date, dtype: int64
Based on analysis of dates, following conclusions are obtained:
dete_resignations
tafe_resignations
cease_date
column in both datasets.In order to answer to the main question of the analysis, we need to determine the number of years of service. In tafe_resignations
dataset they are indicated in institute_service
column. Let's create similar column in dete_resignations
dataset.
dete_resignations['institute_service'] = dete_resignations['cease_date'] - dete_resignations['dete_start_date']
dete_resignations.head()
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 | institute_service | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
3 | 4 | Resignation | 2012.0 | 2005.0 | 2006.0 | Teacher | Primary | Central Queensland | NaN | Permanent Full-time | False | True | False | False | False | False | False | False | False | False | False | False | False | False | False | False | False | False | Female | 36-40 | NaN | NaN | NaN | NaN | NaN | 7.0 |
5 | 6 | Resignation | 2012.0 | 1994.0 | 1997.0 | Guidance Officer | NaN | Central Office | Education Queensland | Permanent Full-time | False | True | False | False | False | False | False | False | False | True | True | False | False | False | False | False | False | False | Female | 41-45 | NaN | NaN | NaN | NaN | NaN | 18.0 |
8 | 9 | Resignation | 2012.0 | 2009.0 | 2009.0 | Teacher | Secondary | North Queensland | NaN | Permanent Full-time | False | True | False | False | False | False | False | False | False | False | False | False | False | False | False | False | False | False | Female | 31-35 | NaN | NaN | NaN | NaN | NaN | 3.0 |
9 | 10 | Resignation | 2012.0 | 1997.0 | 2008.0 | Teacher Aide | NaN | NaN | NaN | Permanent Part-time | False | False | True | True | True | False | False | False | False | False | False | False | False | False | False | False | False | False | Female | 46-50 | NaN | NaN | NaN | NaN | NaN | 15.0 |
11 | 12 | Resignation | 2012.0 | 2009.0 | 2009.0 | Teacher | Secondary | Far North Queensland | NaN | Permanent Full-time | False | False | False | False | False | False | False | False | False | False | True | True | False | False | False | False | False | False | Male | 31-35 | NaN | NaN | NaN | NaN | NaN | 3.0 |
dete_resignations['institute_service'].value_counts(dropna=False)
5.0 23 1.0 22 0.0 20 3.0 20 6.0 17 4.0 16 9.0 14 2.0 14 7.0 13 8.0 8 20.0 7 15.0 7 13.0 7 22.0 6 17.0 6 10.0 6 14.0 6 12.0 6 18.0 5 16.0 5 23.0 4 24.0 4 11.0 4 21.0 3 19.0 3 32.0 3 39.0 3 25.0 2 30.0 2 36.0 2 26.0 2 28.0 2 27.0 1 42.0 1 41.0 1 35.0 1 38.0 1 33.0 1 34.0 1 49.0 1 29.0 1 31.0 1 Name: institute_service, dtype: int64
tafe_resignations['institute_service'].value_counts(dropna=False)
Less than 1 year 73 1-2 64 3-4 63 NaN 50 5-6 33 11-20 26 7-10 21 More than 20 years 10 Name: institute_service, dtype: int64
# Check if we can use any logic to fill the missing values
tafe_resignations[tafe_resignations['institute_service'].isnull()]
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 | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
3 | 6.341399e+17 | Mount Isa Institute of TAFE | Non-Delivery (corporate) | 2010.0 | Resignation | - | - | - | - | - | - | - | - | - | Travel | - | - | NaN | NaN | NaN | NaN | NaN | NaN |
16 | 6.341770e+17 | Brisbane North Institute of TAFE | Non-Delivery (corporate) | 2010.0 | Resignation | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN |
18 | 6.341779e+17 | Brisbane North Institute of TAFE | Delivery (teaching) | 2010.0 | Resignation | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN |
19 | 6.341820e+17 | Southbank Institute of Technology | Non-Delivery (corporate) | 2010.0 | Resignation | - | - | - | - | - | - | - | - | - | - | - | NONE | NaN | NaN | NaN | NaN | NaN | NaN |
20 | 6.341821e+17 | Brisbane North Institute of TAFE | Non-Delivery (corporate) | 2010.0 | Resignation | - | - | - | - | - | Contributing Factors. Dissatisfaction | Job Dissatisfaction | - | - | - | - | - | NaN | NaN | NaN | NaN | NaN | NaN |
21 | 6.341831e+17 | Brisbane North Institute of TAFE | Non-Delivery (corporate) | 2010.0 | Resignation | - | Career Move - Private Sector | - | - | - | - | - | - | - | - | - | - | NaN | NaN | NaN | NaN | NaN | NaN |
26 | 6.341934e+17 | Mount Isa Institute of TAFE | Non-Delivery (corporate) | 2010.0 | Resignation | - | Career Move - Private Sector | - | - | - | Contributing Factors. Dissatisfaction | Job Dissatisfaction | - | - | - | - | - | NaN | NaN | NaN | NaN | NaN | NaN |
36 | 6.342062e+17 | Sunshine Coast Institute of TAFE | Non-Delivery (corporate) | 2010.0 | Resignation | Career Move - Public Sector | Career Move - Private Sector | - | - | - | - | - | - | - | - | Other | - | NaN | NaN | NaN | NaN | NaN | NaN |
37 | 6.342080e+17 | Southbank Institute of Technology | Non-Delivery (corporate) | 2010.0 | Resignation | - | - | - | - | - | - | - | - | - | Travel | - | - | NaN | NaN | NaN | NaN | NaN | NaN |
39 | 6.342081e+17 | Southbank Institute of Technology | Non-Delivery (corporate) | 2010.0 | Resignation | Career Move - Public Sector | - | - | - | - | - | - | - | - | - | - | - | NaN | NaN | NaN | NaN | NaN | NaN |
51 | 6.342141e+17 | Southbank Institute of Technology | Non-Delivery (corporate) | 2010.0 | Resignation | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN |
53 | 6.342148e+17 | Brisbane North Institute of TAFE | Non-Delivery (corporate) | 2010.0 | Resignation | Career Move - Public Sector | - | - | - | - | - | - | - | - | - | - | - | NaN | NaN | NaN | NaN | NaN | NaN |
54 | 6.342174e+17 | Mount Isa Institute of TAFE | Non-Delivery (corporate) | 2010.0 | Resignation | - | - | - | - | - | Contributing Factors. Dissatisfaction | - | - | - | - | Other | - | NaN | NaN | NaN | NaN | NaN | NaN |
87 | 6.342574e+17 | Central Queensland Institute of TAFE | Non-Delivery (corporate) | 2010.0 | Resignation | Career Move - Public Sector | - | - | - | - | - | - | - | - | - | - | - | NaN | NaN | NaN | NaN | NaN | NaN |
91 | 6.342661e+17 | Southern Queensland Institute of TAFE | Non-Delivery (corporate) | 2010.0 | Resignation | - | Career Move - Private Sector | - | Ill Health | - | - | - | - | - | - | - | - | NaN | NaN | NaN | NaN | NaN | NaN |
94 | 6.342679e+17 | Sunshine Coast Institute of TAFE | Non-Delivery (corporate) | 2011.0 | Resignation | - | - | - | - | - | - | - | - | - | - | - | - | NaN | NaN | NaN | NaN | NaN | NaN |
97 | 6.342686e+17 | Sunshine Coast Institute of TAFE | Non-Delivery (corporate) | 2011.0 | Resignation | Career Move - Public Sector | - | - | - | - | Contributing Factors. Dissatisfaction | Job Dissatisfaction | Interpersonal Conflict | - | - | - | - | NaN | NaN | NaN | NaN | NaN | NaN |
101 | 6.342745e+17 | Sunshine Coast Institute of TAFE | Non-Delivery (corporate) | 2010.0 | Resignation | - | - | - | Ill Health | - | Contributing Factors. Dissatisfaction | - | Interpersonal Conflict | - | - | - | - | NaN | NaN | NaN | NaN | NaN | NaN |
102 | 6.342746e+17 | Sunshine Coast Institute of TAFE | Non-Delivery (corporate) | 2010.0 | Resignation | - | - | - | Ill Health | - | Contributing Factors. Dissatisfaction | - | Interpersonal Conflict | - | - | - | - | NaN | NaN | NaN | NaN | NaN | NaN |
113 | 6.342978e+17 | Brisbane North Institute of TAFE | Non-Delivery (corporate) | NaN | Resignation | - | - | - | - | - | Contributing Factors. Dissatisfaction | - | - | - | Travel | - | - | NaN | NaN | NaN | NaN | NaN | NaN |
130 | 6.343264e+17 | Southbank Institute of Technology | Non-Delivery (corporate) | 2011.0 | Resignation | - | - | - | - | Maternity/Family | - | - | - | - | - | - | - | NaN | NaN | NaN | NaN | NaN | NaN |
135 | 6.343283e+17 | Brisbane North Institute of TAFE | Delivery (teaching) | NaN | Resignation | - | - | - | - | - | Contributing Factors. Dissatisfaction | - | - | - | - | - | - | NaN | NaN | NaN | NaN | NaN | NaN |
138 | 6.343333e+17 | Southbank Institute of Technology | Non-Delivery (corporate) | 2011.0 | Resignation | - | Career Move - Private Sector | - | - | - | - | - | - | - | - | - | - | NaN | NaN | NaN | NaN | NaN | NaN |
169 | 6.343811e+17 | Tropical North Institute of TAFE | Non-Delivery (corporate) | 2011.0 | Resignation | - | - | - | - | - | Contributing Factors. Dissatisfaction | Job Dissatisfaction | - | - | - | - | - | NaN | NaN | NaN | NaN | NaN | NaN |
204 | 6.344568e+17 | Southbank Institute of Technology | Non-Delivery (corporate) | 2010.0 | Resignation | - | - | - | - | - | Contributing Factors. Dissatisfaction | - | Interpersonal Conflict | - | - | - | - | NaN | NaN | NaN | NaN | NaN | NaN |
234 | 6.344993e+17 | SkillsTech Australia | Non-Delivery (corporate) | 2010.0 | Resignation | - | - | - | - | - | - | Job Dissatisfaction | - | - | - | - | - | NaN | NaN | NaN | NaN | NaN | NaN |
243 | 6.345234e+17 | Sunshine Coast Institute of TAFE | Non-Delivery (corporate) | 2011.0 | Resignation | - | - | - | - | - | - | - | - | - | - | Other | - | NaN | NaN | NaN | NaN | NaN | NaN |
258 | 6.345510e+17 | Tropical North Institute of TAFE | Non-Delivery (corporate) | 2011.0 | Resignation | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN |
276 | 6.345581e+17 | SkillsTech Australia | Delivery (teaching) | 2011.0 | Resignation | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN |
279 | 6.345632e+17 | Brisbane North Institute of TAFE | Non-Delivery (corporate) | 2011.0 | Resignation | - | - | - | Ill Health | - | - | - | - | - | - | - | - | NaN | NaN | NaN | NaN | NaN | NaN |
287 | 6.345647e+17 | SkillsTech Australia | Delivery (teaching) | 2011.0 | Resignation | - | - | - | - | - | - | - | - | - | - | - | - | NaN | NaN | NaN | NaN | NaN | NaN |
373 | 6.345925e+17 | Sunshine Coast Institute of TAFE | Non-Delivery (corporate) | 2011.0 | Resignation | - | - | - | - | - | Contributing Factors. Dissatisfaction | Job Dissatisfaction | Interpersonal Conflict | - | - | - | - | NaN | NaN | NaN | NaN | NaN | NaN |
412 | 6.346668e+17 | Brisbane North Institute of TAFE | Delivery (teaching) | 2012.0 | Resignation | - | - | - | - | - | - | Job Dissatisfaction | - | - | - | - | - | NaN | NaN | NaN | NaN | NaN | NaN |
423 | 6.346832e+17 | Central Queensland Institute of TAFE | Non-Delivery (corporate) | 2012.0 | Resignation | - | - | - | - | - | - | - | - | - | - | Other | - | NaN | NaN | NaN | NaN | NaN | NaN |
437 | 6.346963e+17 | Tropical North Institute of TAFE | Non-Delivery (corporate) | 2012.0 | Resignation | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN |
513 | 6.347827e+17 | Southbank Institute of Technology | Non-Delivery (corporate) | NaN | Resignation | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN |
530 | 6.348110e+17 | Tropical North Institute of TAFE | Delivery (teaching) | 2012.0 | Resignation | - | - | - | - | - | - | - | - | - | - | - | NONE | NaN | NaN | NaN | NaN | NaN | NaN |
533 | 6.348112e+17 | Southbank Institute of Technology | Delivery (teaching) | 2012.0 | Resignation | - | - | - | - | - | - | - | - | - | - | - | - | NaN | NaN | NaN | NaN | NaN | NaN |
535 | 6.348129e+17 | Tropical North Institute of TAFE | Delivery (teaching) | 2012.0 | Resignation | - | - | - | - | - | - | - | - | - | - | - | - | NaN | NaN | NaN | NaN | NaN | NaN |
539 | 6.348187e+17 | Southbank Institute of Technology | Non-Delivery (corporate) | 2012.0 | Resignation | - | - | - | Ill Health | - | - | - | - | - | - | - | - | NaN | NaN | NaN | NaN | NaN | NaN |
579 | 6.348785e+17 | Southern Queensland Institute of TAFE | Non-Delivery (corporate) | 2012.0 | Resignation | - | - | - | - | - | - | - | - | - | - | - | NONE | NaN | NaN | NaN | NaN | NaN | NaN |
621 | 6.349156e+17 | Central Queensland Institute of TAFE | Non-Delivery (corporate) | 2013.0 | Resignation | Career Move - Public Sector | - | - | - | - | - | - | - | - | - | - | - | NaN | NaN | NaN | NaN | NaN | NaN |
625 | 6.349375e+17 | Southern Queensland Institute of TAFE | Delivery (teaching) | 2013.0 | Resignation | Career Move - Public Sector | - | - | - | - | Contributing Factors. Dissatisfaction | - | - | - | - | - | - | NaN | NaN | NaN | NaN | NaN | NaN |
628 | 6.349384e+17 | Tropical North Institute of TAFE | Delivery (teaching) | 2013.0 | Resignation | - | Career Move - Private Sector | - | - | - | - | - | - | - | - | Other | - | NaN | NaN | NaN | NaN | NaN | NaN |
665 | 6.350055e+17 | Tropical North Institute of TAFE | Delivery (teaching) | 2013.0 | Resignation | - | - | - | Ill Health | - | - | - | - | - | - | - | - | NaN | NaN | NaN | NaN | NaN | NaN |
666 | 6.350055e+17 | Tropical North Institute of TAFE | Delivery (teaching) | 2013.0 | Resignation | - | - | - | - | - | - | - | - | - | - | - | - | NaN | NaN | NaN | NaN | NaN | NaN |
670 | 6.350124e+17 | Tropical North Institute of TAFE | Delivery (teaching) | 2013.0 | Resignation | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN |
690 | 6.350496e+17 | Southern Queensland Institute of TAFE | Non-Delivery (corporate) | 2013.0 | Resignation | - | - | - | Ill Health | - | - | - | - | - | - | - | - | NaN | NaN | NaN | NaN | NaN | NaN |
694 | 6.350652e+17 | Sunshine Coast Institute of TAFE | Non-Delivery (corporate) | 2013.0 | Resignation | - | Career Move - Private Sector | - | - | - | - | - | - | - | - | - | - | NaN | NaN | NaN | NaN | NaN | NaN |
698 | 6.350677e+17 | Southern Queensland Institute of TAFE | Non-Delivery (corporate) | 2013.0 | Resignation | Career Move - Public Sector | - | - | - | - | - | - | - | - | - | - | - | NaN | NaN | NaN | NaN | NaN | NaN |
We have to drop these missing values since there are no indications about the value imputation. Imputing a mean value can affect analysis results and make them biased since we have a lot of NaN values.
tafe_resignations.drop(tafe_resignations[tafe_resignations['institute_service'].isnull()].index, inplace=True)
# Check
tafe_resignations['institute_service'].value_counts(dropna=False)
Less than 1 year 73 1-2 64 3-4 63 5-6 33 11-20 26 7-10 21 More than 20 years 10 Name: institute_service, dtype: int64
Now, let's create a new column dissatisfied
in each dataframe. This column will indicate whether the resignation was caused by dissatisfaction.
Columns Contributing Factors. Dissatisfaction
and Contributing Factors. Job Dissatisfaction
indicate dissatisfaction in tafe_resignations
dataset.
tafe_resignations['Contributing Factors. Dissatisfaction'].unique()
array(['-', 'Contributing Factors. Dissatisfaction '], dtype=object)
tafe_resignations['Contributing Factors. Job Dissatisfaction'].unique()
array(['-', 'Job Dissatisfaction'], dtype=object)
tafe_diss_factors = ['Contributing Factors. Dissatisfaction', 'Contributing Factors. Job Dissatisfaction']
# Apply a function to transform all values in these columns into boolean format
tafe_resignations[tafe_diss_factors] = tafe_resignations[tafe_diss_factors].applymap(lambda x: False if x == '-' else True)
tafe_resignations['Contributing Factors. Dissatisfaction'].value_counts()
False 247 True 43 Name: Contributing Factors. Dissatisfaction, dtype: int64
tafe_resignations['Contributing Factors. Job Dissatisfaction'].value_counts()
False 235 True 55 Name: Contributing Factors. Job Dissatisfaction, dtype: int64
# Create new column to mark "True" if person is dissastisfied due to any of 2 resons
tafe_resignations['dissatisfied'] = tafe_resignations[tafe_diss_factors].any(axis=1, skipna=False)
tafe_resignations.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. 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 | dissatisfied | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
4 | 6.341466e+17 | Southern Queensland Institute of TAFE | Delivery (teaching) | 2010.0 | Resignation | - | Career Move - Private Sector | - | - | - | False | False | - | - | - | - | - | Male | 41 45 | Permanent Full-time | Teacher (including LVT) | 3-4 | 3-4 | False |
5 | 6.341475e+17 | Southern Queensland Institute of TAFE | Delivery (teaching) | 2010.0 | Resignation | - | - | - | - | - | False | False | - | - | - | Other | - | Female | 56 or older | Contract/casual | Teacher (including LVT) | 7-10 | 7-10 | False |
6 | 6.341520e+17 | Barrier Reef Institute of TAFE | Non-Delivery (corporate) | 2010.0 | Resignation | - | Career Move - Private Sector | - | - | Maternity/Family | False | False | - | - | - | Other | - | Male | 20 or younger | Temporary Full-time | Administration (AO) | 3-4 | 3-4 | False |
7 | 6.341537e+17 | Southern Queensland Institute of TAFE | Delivery (teaching) | 2010.0 | Resignation | - | - | - | - | - | False | False | - | - | - | Other | - | Male | 46 50 | Permanent Full-time | Teacher (including LVT) | 3-4 | 3-4 | False |
8 | 6.341579e+17 | Southern Queensland Institute of TAFE | Delivery (teaching) | 2009.0 | Resignation | - | - | - | - | - | False | False | - | - | - | Other | - | Female | 36 40 | Temporary Full-time | Tutor | 3-4 | 3-4 | False |
tafe_resignations['dissatisfied'].value_counts()
False 213 True 77 Name: dissatisfied, dtype: int64
Following columns indicate dissatisfaction in dete_resignations
dataset:
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_diss_factors = ['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_diss_factors].describe(include='all')
job_dissatisfaction | dissatisfaction_with_the_department | physical_work_environment | lack_of_recognition | lack_of_job_security | work_location | employment_conditions | work_life_balance | workload | |
---|---|---|---|---|---|---|---|---|---|
count | 272 | 272 | 272 | 272 | 272 | 272 | 272 | 272 | 272 |
unique | 2 | 2 | 2 | 2 | 2 | 2 | 2 | 2 | 2 |
top | False | False | False | False | False | False | False | False | False |
freq | 234 | 244 | 266 | 244 | 259 | 255 | 253 | 209 | 248 |
Fortunately, columns in dete_resignations
are already in the desired format.
dete_resignations['dissatisfied'] = dete_resignations[dete_diss_factors].any(axis=1, skipna=False)
dete_resignations['dissatisfied'].value_counts()
True 137 False 135 Name: dissatisfied, dtype: int64
# Create a copy to avoid "SettingWithCopy" Warning
dete_resignations_up = dete_resignations.copy()
tafe_resignations_up = tafe_resignations.copy()
# Create new columns in both datasets to distinct between them after merging.
dete_resignations_up['institute'] = 'DETE'
tafe_resignations_up['institute'] = 'TAFE'
combined = pd.concat([dete_resignations_up, tafe_resignations_up], ignore_index=True)
combined.shape
(562, 53)
combined.notnull().sum().sort_values()
torres_strait 0 south_sea 2 aboriginal 7 nesb 8 disability 8 business_unit 28 classification 145 region 233 role_start_date 262 relocation 272 study/travel 272 ill_health 272 workload 272 work_life_balance 272 none_of_the_above 272 maternity/family 272 traumatic_incident 272 work_location 272 employment_conditions 272 lack_of_recognition 272 physical_work_environment 272 dissatisfaction_with_the_department 272 job_dissatisfaction 272 interpersonal_conflicts 272 career_move_to_private_sector 272 career_move_to_public_sector 272 lack_of_job_security 272 dete_start_date 272 Contributing Factors. Career Move - Private Sector 290 Contributing Factors. Career Move - Self-employment 290 Contributing Factors. Ill Health 290 Contributing Factors. Other 290 Contributing Factors. Travel 290 Contributing Factors. Dissatisfaction 290 Contributing Factors. Interpersonal Conflict 290 Contributing Factors. Maternity/Family 290 Contributing Factors. Job Dissatisfaction 290 Contributing Factors. Study 290 Contributing Factors. Career Move - Public Sector 290 role_service 290 Institute 290 Contributing Factors. NONE 290 WorkArea 290 gender 557 position 559 age 560 cease_date 560 institute 562 dissatisfied 562 institute_service 562 employment_status 562 separationtype 562 id 562 dtype: int64
# Drop all the columns with less than 500 non-null values
combined_updated = combined.dropna(thresh=500, axis=1).copy()
combined_updated.head()
id | separationtype | cease_date | position | employment_status | gender | age | institute_service | dissatisfied | institute | |
---|---|---|---|---|---|---|---|---|---|---|
0 | 4.0 | Resignation | 2012.0 | Teacher | Permanent Full-time | Female | 36-40 | 7 | False | DETE |
1 | 6.0 | Resignation | 2012.0 | Guidance Officer | Permanent Full-time | Female | 41-45 | 18 | True | DETE |
2 | 9.0 | Resignation | 2012.0 | Teacher | Permanent Full-time | Female | 31-35 | 3 | False | DETE |
3 | 10.0 | Resignation | 2012.0 | Teacher Aide | Permanent Part-time | Female | 46-50 | 15 | True | DETE |
4 | 12.0 | Resignation | 2012.0 | Teacher | Permanent Full-time | Male | 31-35 | 3 | False | DETE |
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 8.0 8 13.0 7 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
Since we used different classification in these datasets, our values in institute_service
column are inconsistent. Let's classify them in the following categories:
# Use regex to extract a value from each and convert it to float type
combined_updated['institute_service'] = combined_updated['institute_service'].astype(str)
combined_updated['institute_service'] = combined_updated['institute_service'].str.extract(r'(\d+)')
combined_updated['institute_service'] = combined_updated['institute_service'].astype(float)
# Check
combined_updated['institute_service'].value_counts(dropna=False)
1.0 159 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 8.0 8 13.0 7 15.0 7 10.0 6 14.0 6 22.0 6 17.0 6 12.0 6 16.0 5 18.0 5 23.0 4 24.0 4 39.0 3 19.0 3 21.0 3 32.0 3 28.0 2 26.0 2 36.0 2 25.0 2 30.0 2 29.0 1 38.0 1 42.0 1 27.0 1 41.0 1 35.0 1 33.0 1 49.0 1 34.0 1 31.0 1 Name: institute_service, dtype: int64
def stage(val):
'''Classify service years into 4 groups'''
if pd.isnull(val):
return np.nan
elif val < 3:
return 'New'
elif val >= 3 and val <= 6:
return 'Experienced'
elif val >= 7 and val <= 10:
return 'Established'
elif val > 11:
return 'Veteran'
combined_updated['service_cat'] = combined_updated['institute_service'].apply(stage)
combined_updated.head()
id | separationtype | cease_date | position | employment_status | gender | age | institute_service | dissatisfied | institute | service_cat | |
---|---|---|---|---|---|---|---|---|---|---|---|
0 | 4.0 | Resignation | 2012.0 | Teacher | Permanent Full-time | Female | 36-40 | 7.0 | False | DETE | Established |
1 | 6.0 | Resignation | 2012.0 | Guidance Officer | Permanent Full-time | Female | 41-45 | 18.0 | True | DETE | Veteran |
2 | 9.0 | Resignation | 2012.0 | Teacher | Permanent Full-time | Female | 31-35 | 3.0 | False | DETE | Experienced |
3 | 10.0 | Resignation | 2012.0 | Teacher Aide | Permanent Part-time | Female | 46-50 | 15.0 | True | DETE | Veteran |
4 | 12.0 | Resignation | 2012.0 | Teacher | Permanent Full-time | Male | 31-35 | 3.0 | False | DETE | Experienced |
combined_updated['dissatisfied'].value_counts(dropna=False)
False 348 True 214 Name: dissatisfied, dtype: int64
Since we performed accurate data cleaning in previous stages of this project, no missing values are found.
combined_updated['service_cat'].value_counts(dropna=False)
New 193 Experienced 172 Veteran 105 Established 62 NaN 30 Name: service_cat, dtype: int64
diss_table = combined_updated.pivot_table(values='dissatisfied', index='service_cat') # Since True = 1, mean function gives %
diss_table.plot(kind='barh', xlim=(0,1), title='Dissatisfaction by working experience', xlabel = '')
<AxesSubplot:title={'center':'Dissatisfaction by working experience'}>
combined_updated['gender'].value_counts(dropna=False)
Female 396 Male 161 NaN 5 Name: gender, dtype: int64
# Fill missing values in "gender" column with the most popular one
combined_updated['gender'].fillna('Female', inplace=True)
# Add 1 more dimension to the previous pivot table
diss_table_gender = combined_updated.pivot_table(values='dissatisfied', columns='gender', index='service_cat')
diss_table_gender
gender | Female | Male |
---|---|---|
service_cat | ||
Established | 0.545455 | 0.444444 |
Experienced | 0.369748 | 0.283019 |
New | 0.262411 | 0.384615 |
Veteran | 0.551282 | 0.592593 |
diss_table_gender.plot(kind='barh', xlim=(0,1), title='Dissatisfaction by working experience and gender', xlabel = '')
<AxesSubplot:title={'center':'Dissatisfaction by working experience and gender'}>
combined_updated['age'].value_counts(dropna=False)
51-55 69 41 45 45 41-45 44 46 50 39 36-40 36 21 25 33 46-50 33 26 30 32 31 35 32 36 40 32 26-30 31 31-35 29 56 or older 29 21-25 26 56-60 22 61 or older 18 20 or younger 10 NaN 2 Name: age, dtype: int64
# Clean "age" column
combined_updated['age'] = combined_updated['age'].astype(str)
combined_updated['age'] = combined_updated['age'].str.extract(r'(\d+)')
combined_updated['age'] = combined_updated['age'].astype(float)
combined_updated['age'].value_counts(dropna=False)
41.0 89 46.0 72 51.0 69 36.0 68 26.0 63 31.0 61 21.0 59 56.0 51 61.0 18 20.0 10 NaN 2 Name: age, dtype: int64
# Fill missing values with rounded mean
combined_updated['age'].fillna(round(combined_updated['age'].mean()), inplace=True)
def age_group(val):
'''Classify age into 4 groups'''
if val <= 25:
return '25 or younger'
elif val >25 and val <= 40:
return '26 to 40'
elif val > 40 and val <= 55:
return '41 to 55'
elif val >=56:
return '56 and older'
combined_updated['age_cat'] = combined_updated['age'].apply(age_group)
combined_updated.head()
id | separationtype | cease_date | position | employment_status | gender | age | institute_service | dissatisfied | institute | service_cat | age_cat | |
---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | 4.0 | Resignation | 2012.0 | Teacher | Permanent Full-time | Female | 36.0 | 7.0 | False | DETE | Established | 26 to 40 |
1 | 6.0 | Resignation | 2012.0 | Guidance Officer | Permanent Full-time | Female | 41.0 | 18.0 | True | DETE | Veteran | 41 to 55 |
2 | 9.0 | Resignation | 2012.0 | Teacher | Permanent Full-time | Female | 31.0 | 3.0 | False | DETE | Experienced | 26 to 40 |
3 | 10.0 | Resignation | 2012.0 | Teacher Aide | Permanent Part-time | Female | 46.0 | 15.0 | True | DETE | Veteran | 41 to 55 |
4 | 12.0 | Resignation | 2012.0 | Teacher | Permanent Full-time | Male | 31.0 | 3.0 | False | DETE | Experienced | 26 to 40 |
diss_table_age = combined_updated.pivot_table(values='dissatisfied', index='age_cat')
diss_table_age
dissatisfied | |
---|---|
age_cat | |
25 or younger | 0.275362 |
26 to 40 | 0.376289 |
41 to 55 | 0.404348 |
56 and older | 0.420290 |
diss_table_age.plot(kind='barh', xlim=(0,1), title='Dissatisfaction by age', xlabel = '')
<AxesSubplot:title={'center':'Dissatisfaction by age'}>
In this project we explored the datasets from Department of Education, Training and Employment (DETE) and the Technical and Further Education (TAFE) institute in Queensland, Australia. Based on the stated goals, the following conclusions have been obtained: