text_plain_output_1.png image_output_1.png
import pandas as pd

import seaborn as sns

import warnings    # We want to suppress warnings

warnings.filterwarnings('ignore')
HRData = pd.read_csv('../input/WA_Fn-UseC_-HR-Employee-Attrition.csv')

HRData.isnull().any()

hrdunique = HRData.nunique()
hrdunique = hrdunique.sort_values()
hrdunique

hrd = HRData.copy()
hrd.drop('Over18', axis=1, inplace=True)
hrd.drop('StandardHours', axis=1, inplace=True)
hrd.drop('EmployeeNumber', axis=1, inplace=True)
hrd.drop('EmployeeCount', axis=1, inplace=True)

hrd.groupby('Attrition').mean()

df = pd.DataFrame(hrd, columns=['Gender', 'Department', 'Attrition'])
groupby_DeptnAttrition = df['Gender'].groupby([df['Department'], df['Attrition']])

num_bins = 30

fig, ax = plt.subplots(1, 2, figsize=(18, 4))
sns.barplot(x='Attrition', y='DistanceFromHome', data=hrd, ax=ax[0])
sns.barplot(x='Gender', y='JobSatisfaction', data=hrd, ax=ax[1])