To detect outliers in a input variable(X) using python.
Import library functions.
Read the data set.
Use sns.boxplot() from seaborn library.
Pass the input variable to the ().
Single variable box plot
#import library functions
import seaborn as sns
import pandas as pd
#Read the data set
data=pd.read_csv(‘/home/soft27/soft27
/Sathish/Pythonfiles/Employee.csv’)
#create data frame
df=pd.DataFrame(data)
#use box plot functions
sns.boxplot(df[‘age’])
sns.despine()
#Multi variable box plot
#import library functions
import seaborn as sns
import pandas as pd
#Read the data set
data=pd.read_csv(‘/home/soft27/soft27
/Sathish/Pythonfiles/Employee.csv’)
#create data frame
df=pd.DataFrame(data)
#use box plot functions
sns.boxplot(df[‘age’],df[‘salary’])
sns.despine()