To detect and remove the outliers available in the given csv file.
Create a new folder in Jupyter Notebook.
Upload the csv file and create a new python kernel.
In the python kernel import the pandas and write to codes to remove the outliers.
Use the quantile formulas and boxplot()to view the graph.
End of Program.
import pandas as pd
df=pd.read_csv("weight.csv")
print(df)
df.drop("Gender", axis=1)
df
df.drop('Gender',axis=1,inplace=True)
df.boxplot()
from scipy import stats
import numpy as np
z=np.abs(stats.zscore(df))
df1=df.copy()
df1=df[(z<3).all(axis=1)]
df1.boxplot()
df2=df.copy()
q1=df2.quantile(0.25)
q3=df2.quantile(0.75)
IQR=q3-q1
df2_new=df2[((df2>=q1-1.5*IQR)&(df2<=q3+1.5*IQR)).all(axis=1)]
df2_new.boxplot()
df2_new
Thus the given outliers in the given csv file has been removed.