How do you read a box plot?
A box plot shows the median, Q1 and Q3 as a box, whiskers reaching the furthest points within 1.5 x IQR of the box, and dots for points beyond that. It summarises centre, spread, skew and outliers in one compact picture.
Explain it simply
A box plot is a five-number summary drawn as a picture. The box holds the middle 50% of the data. The line inside it is the median. The whiskers stretch to the normal extremes and any dots beyond them are flagged as outliers.
Example
Data: 10, 12, 12, 13, 14, 15, 16, 18, 100.
- Median = 14
- Q1 = 12, Q3 = 16, so IQR = 4
- Upper fence = 16 + 1.5 x 4 = 22; lower fence = 12 - 6 = 6
- Whiskers: lower down to 10, upper up to 18 (the largest value inside the fence)
- 100 lies above 22, so it is drawn as a dot
import pandas as pd
d = pd.Series([10, 12, 12, 13, 14, 15, 16, 18, 100])
q1, q3 = d.quantile(0.25), d.quantile(0.75)
print(q1, q3) # 12.0 16.0
print(d[d > q3 + 1.5 * (q3 - q1)].tolist()) # [100]Reading shape: if the median line sits near one side of the box, or one whisker is longer, the data is skewed that way.
What to say in the interview
"The box spans Q1 to Q3 with the median inside, whiskers extend to the last point within 1.5 times the IQR, and points beyond are shown individually as potential outliers. I use box plots to compare a numeric column across groups, for instance salary by city."
Common mistakes
- Treating the whisker ends as min and max. They are only the min and max inside the fences.