Quartiles and Box Plots
The middle half.
The twenty fifth, fiftieth, and seventy fifth percentiles have a special name. The quartiles. They split the data into four equal parts. And a box plot draws them as a picture.

- 25th, 50th, 75th percentiles
- Four equal parts
- A box plot draws them
The parts of a box plot
The box goes from the first quartile, Q one, to the third quartile, Q three. So it holds the middle half of the data. The line inside is the median. The whiskers reach out to the rest of the data. And dots beyond the whiskers are possible outliers.
Comparing groups
Box plots are great for comparing groups side by side. Here are delivery times from three shops. Run it. Shop B is fastest. Shop C has the widest box, so it's the least predictable, and it has some very slow outliers.
import numpy as np
import matplotlib.pyplot as plt
rng = np.random.default_rng(3)
a = rng.normal(30, 4, 200)
b = rng.normal(22, 3, 200)
c = np.append(rng.normal(28, 9, 195), [70, 75, 80, 85, 90])
plt.boxplot([a, b, c], tick_labels=["Shop A", "Shop B", "Shop C"])
plt.title("Delivery time (minutes)")
plt.savefig("box.png")Summary
Quartiles split data into four parts, and a box plot shows the middle half, the median, and the outliers. Next, finding outliers with a rule.
Key takeaways- Q1, median, Q3
- Box is the middle half
- Great for comparing groups