Data Science

Box Plots: Identifying Outliers

SQL Mastery Team
June 4, 2026
6 min read

Welcome to **Day 134**. Today we look at the chart that scares beginners but delights experts: the **Box Plot**.

What is a Box Plot?

It shows the "Median," the "Quartiles" (25% and 75%), and the "Outliers."

The Code

# Compare salary across different departments

sns.boxplot(data=df, x='dept', y='salary')

plt.show()

How to read the "Whiskers"

  • **The Box**: Contains 50% of your data.
  • **The Line inside**: The Median (Middle).
  • **The Individual Dots**: These are **Outliers**. Data points that are so extreme they might be errors or very interesting anomalies.
  • Why it's critical for Data Science

    Before شما run an average, شما need to see if outliers are "Dragging" the mean. If 10 people earn $50k and 1 person earns $10 million, the average ($950k) is useless. The box plot shows this instantly.

    Your Task for Today

    Choose a numerical column and draw a box plot to see if شما have any extreme outliers.

    *Day 135: Violin Plots: Aesthetics + Statistics.*

    Ready to put your knowledge into practice?

    Join SQL Mastery and learn through interactive exercises.