text_plain_output_1.png image_output_1.png
import pandas as pd

import seaborn as sns

data = pd.read_csv('../input/HR_comma_sep.csv')

corr = data.corr()
corr = corr
corr

corr_left = pd.DataFrame(corr['left'].drop('left'))
corr_left.sort_values(by='left', ascending=False)

data['avg_hour_project'] = data['average_montly_hours'] * 12 / data['number_project']
data['avg_hour_project_range'] = pd.cut(data['avg_hour_project'], 3)
data[['avg_hour_project_range', 'left']].groupby(['avg_hour_project_range']).mean()

data.loc[data['avg_hour_project'] <= 749.333, 'avg_hour_project'] = 0
data.loc[(data['avg_hour_project'] > 749.333) & (data['avg_hour_project'] <= 1304.667), 'avg_hour_project'] = 1
data.loc[(data['avg_hour_project'] > 1304.667) & (data['avg_hour_project'] <= 1860.0), 'avg_hour_project'] = 2
data.drop(['avg_hour_project_range'], axis=1, inplace=True)

dropdata = data[data['time_spend_company'] >= 8]
data.drop(dropdata.index, inplace=True)

data['avg_mon_hours_range'] = pd.cut(data['average_montly_hours'], 3)
data[['avg_mon_hours_range', 'left']].groupby(['avg_mon_hours_range']).mean()