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
churnhas 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
Bu egzersiz
HR Analytics: Predicting Employee Churn in Python
kursunun bir parçasıdırEgzersiz talimatları
- 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.
Uygulamalı interaktif egzersiz
Bu örnek kodu tamamlayarak bu egzersizi bitirin.
# 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)