Charts are the fastest way to spot outliers, and you should look at them before applying any formula.
Box plot
A box plot shows the median, the quartiles (Q1, Q3) and whiskers. Points beyond the whiskers are potential outliers.
import matplotlib.pyplot as plt
import seaborn as sns
sns.boxplot(x=df["Fare"])
plt.title("Box plot of Fare")
plt.show()
Histogram
A histogram reveals a long tail or isolated bars far from the main mass of data.
df["Fare"].hist(bins=50)
plt.xlabel("Fare")
plt.ylabel("Count")
plt.show()
Scatter plot
Useful for finding outliers that only look strange when two variables are seen together.
plt.scatter(df["Age"], df["Fare"], alpha=0.6)
plt.xlabel("Age")
plt.ylabel("Fare")
plt.show()
What to look for
| Chart | Outlier signal |
|---|---|
| Box plot | Dots beyond the whiskers |
| Histogram | Isolated bars far from the main distribution, long tails |
| Scatter plot | Points far away from the cloud or from the trend line |
Visual checks are subjective, so combine them with the statistical methods on the next pages.