Get startedGet started for free

Employee churn study

Acquiring new employees as replacements incurs hiring costs and training costs. You want to predict how long current employees will stay. This exercise focuses on the first steps to prepare to make predictions.

You have a DataFrame called employees. It contains data about 1470 employees (churned and present) and how their survey answers. The survey is across the following dimensions:

  • environment_satisfaction
  • job_satisfaction
  • relationship_satisfaction
  • work_life_balance

Additionally, years_at_company means the duration employees have worked and attrition indicates if the employee has churned (1 if churn, 0 otherwise).

Sample rows are printed for you in the console. The CoxPHFitter class is imported for you from the lifelines package.

This exercise is part of the course

Survival Analysis in Python

View Course

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

# Instantiate a CoxPHFitter object cph
cph = ____()

# Fit cph on all covariates
cph.____(____)
Edit and Run Code