text_plain_output_1.png image_output_1.png
import pandas as pd

df = pd.read_csv('../input/hr-analytics/HR_comma_sep.csv')

left = df[df.left == 1]
left.shape

retained = df[df.left == 0]
retained.shape

df.groupby('left').mean()

df_new = df[['satisfaction_level', 'average_montly_hours', 'promotion_last_5years', 'salary']]

dummy_salary = pd.get_dummies(df_new.salary, prefix='salary')

df_new_with_dummy = pd.concat([df_new, dummy_salary], axis='columns')

df_new_with_dummy.drop('salary', axis='columns', inplace=True)
df_new_with_dummy.head()