Distributions, quartiles and outliers
Not met yet
A distribution is how readings are spread out, and a histogram shows its shape. Daily rain is skewed right: most days pile up near zero and a few wet ones stretch away in a long tail, which drags the mean out past the median. values.quantile(0.25) is the value a quarter of the way up the sorted readings; the first and third quartiles hold the middle half between them. One rule for outliers sets fences one and a half middle-halves beyond the quartiles and flags anything outside. It's a question, not a verdict: a stuck sensor is an error, but in a skewed distribution plenty of real days fall outside too.
Try it
main.pyOutput
Press Run and what your program prints shows up here.
Easy to get wrong
- Thinks every reading outside the fences is a mistake to delete. In a skewed distribution many real readings fall outside, and each needs a reason before it goes.
- Thinks a distribution skewed to the right has most of its readings on the right. The tail is on the right; most readings sit at the left.
- Thinks quantile(0.25) is a quarter of the largest value, rather than the value a quarter of the way up the sorted readings.