ComeçarComece de graça

Percentage of employees who churn

The column churn is providing information about whether an employee has left the company or not is the column churn:

  • if the value of this column is 0, the employee is still with the company
  • if the value of this column is 1, then the employee has left the company

Let’s calculate the turnover rate:

  • you will first count the number of times the variable churn has the value 1 and the value 0, respectively
  • you will then divide both counts by the total, and multiply the result by 100 to get the percentage of employees who left and stayed

Este exercício faz parte do curso

HR Analytics: Predicting Employee Churn in Python

Ver curso

Instruções do exercício

  • Use the len() function to get the total number of observations and save it as the number of employees.
  • Print the number of employees who left and stayed.
  • Print the percentage of employees who left and stayed.

Exercício interativo prático

Experimente este exercício completando este código de exemplo.

# Use len() function to get the total number of observations and save it as the number of employees
n_employees = ____(data)

# Print the number of employees who left/stayed
print(data.churn.____())

# Print the percentage of employees who left/stayed
print(data.churn.____()/____*100)
Editar e executar o código