Source
Adapted from my own handwritten and hand-typed notes from Year 1 to Year 3 of my EEE degree
Univariate data has observations on a single attribute, e.g. the HP column of the Pokemon data (800 values). Its summary answers two questions:
- what is the central tendency (a typical value)
- what is the spread (how far values stray from it)
Central Tendency
Mean: sum of data divided by count.
Median: the value that splits the data 50:50.
The median is not pulled by extreme values, the mean is.
Dispersion
Standard deviation: the typical deviation from the mean.
pandas std() divides by (sample standard deviation), which is almost the same for large .
Quartiles: markers and that split the data 25:50:25.
HP of Pokemon
| Statistic | Value |
|---|---|
| count | 800 |
| mean | 69.26 |
| std | 25.53 |
| (25%) | 50 |
| median (50%) | 65 |
| (75%) | 80 |
Mean > median here, a hint that the distribution has a longer tail to the right.
Code
hp = pd.DataFrame(pkmndata['HP'])
hp.describe() # count, mean, std, min, 25%, 50%, 75%, max
hp.mean(), hp.median(), hp.std()
hp.quantile([0.25, 0.5, 0.75])These five numbers (min, , median, , max) are exactly what a box plot draws, see Univariate Visualisation.