Chapter 2 · Practice 2 of 4
Look at distributions and real rows, not only averages
Why it matters
Google's guide warns that means and medians hide things like multimodal behaviour, and recommends histograms, cumulative distribution plots and Q-Q plots. It also says to look at examples: sample rows from each class, and look at the extremes as well as the middle.
A quick first pass on any new column:
- count, nulls, distinct values;
- min, max and a few percentiles;
- a histogram;
- ten random rows, plus the ten largest and ten smallest values.
python
import polars as pl
df.select(pl.col("order_total")).describe() # count, nulls, mean, percentiles
df.sample(10, seed=42) # real rows, reproducible
df.sort("order_total", descending=True).head(10)
Outliers often point to a real problem, such as a test account or a unit error. Google's guide says excluding them is fine, but only once you know why they are there.