image_output_1.png
import matplotlib.pyplot as plt

import pandas as pd

import seaborn as sns

dataset_path = '/kaggle/input/hr-analytics-and-job-prediction/HR_comma_sep.csv'
hr = pd.read_csv(dataset_path)

hr.columns

hr.columns = hr.columns.str.lower()
hr.columns = hr.columns.str.replace(' ', '_')
hr.columns = hr.columns.str.replace('\\W', '_', regex=True)
hr.columns

hr.isna().sum()

duplicates_mask = hr.duplicated()
duplicates = hr[duplicates_mask]
duplicates.shape

hr.duplicated().sum()

hr_no_duplicates = hr.drop_duplicates()
hr_no_duplicates

# Determine the number of rows containing outliers

# create a boxplot of the 'time_spend_company' column
_, flier_dict = hr_no_duplicates.boxplot(column='time_spend_company', return_type='both')

# get the values of the outliers
outliers = [flier.get_ydata()[0] for flier in flier_dict['fliers']]

# select the rows that contain the outliers
outlier_rows = hr_no_duplicates['time_spend_company'].isin(outliers)

# count the number of rows that contain the outliers
num_outliers = outlier_rows.sum()

sns.pairplot(hr_no_duplicates)