Skip to content
Competition - employee turnover
0
  • AI Chat
  • Code
  • Report
  • Can you help reduce employee turnover?

    📖 Background

    You work for the human capital department of a large corporation. The Board is worried about the relatively high turnover, and your team must look into ways to reduce the number of employees leaving the company.

    The team needs to understand better the situation, which employees are more likely to leave, and why. Once it is clear what variables impact employee churn, you can present your findings along with your ideas on how to attack the problem.

    💾 The data

    The department has assembled data on almost 10,000 employees. The team used information from exit interviews, performance reviews, and employee records.

    • "department" - the department the employee belongs to.
    • "promoted" - 1 if the employee was promoted in the previous 24 months, 0 otherwise.
    • "review" - the composite score the employee received in their last evaluation.
    • "projects" - how many projects the employee is involved in.
    • "salary" - for confidentiality reasons, salary comes in three tiers: low, medium, high.
    • "tenure" - how many years the employee has been at the company.
    • "satisfaction" - a measure of employee satisfaction from surveys.
    • "bonus" - 1 if the employee received a bonus in the previous 24 months, 0 otherwise.
    • "avg_hrs_month" - the average hours the employee worked in a month.
    • "left" - "yes" if the employee ended up leaving, "no" otherwise.
    import pandas as pd
    df = pd.read_csv('./data/employee_churn_data.csv')
    df.head()
    df.isnull().sum()
    df.shape
    df.info()
    df['salary'].astype('category')
    df.salary.dtypes
    nr_employees=df.groupby('department')['left'].agg(nr_employees='count')
    nr_employees
    type(nr_employees)
    churn_number=df[df.left=='yes'].groupby('department')['left'].agg(churn_number='count')
    churn_number
    department_churn=pd.merge(nr_employees, churn_number,how='inner',on=nr_employees.index )
    department_churn
    department_churn.rename(columns={'key_0':'department'},inplace=True)
    department_churn
    ‌
    ‌
    ‌