graph outlier detection 1

graph outlier detection

#checking for outliers

numerical_features=[feature for feature in df.columns if df[feature].dtypes!='object']
for feature in numerical_features:
    if feature=='class(target)':
        pass
    else:
    
        df[feature].plot.box()
        plt.xlabel(feature)
        plt.show()

Here is what the above code is Doing:
1. We are creating a list of numerical features.
2. We are iterating through the list of numerical features.
3. We are plotting a boxplot for each feature.
4. We are labeling the x-axis with the name of the feature.
5. We are showing the plot.

Similar Posts