Standard Deviation
Spread in real units.
The variance has one annoying problem. Because we squared everything, its units are squared too. Points squared, or dollars squared. That's hard to imagine. The fix is simple. Take the square root.

- Variance is in squared units
- Points squared?
- Take the square root
The square root of variance
The standard deviation is the square root of the variance. NP dot STD computes it directly. Run it. Our scores have a standard deviation of about eighteen points. Roughly speaking, a typical score is about eighteen points away from the mean.
import numpy as np
scores = np.array([55, 72, 90, 40, 81])
print(np.sqrt(np.var(scores)).round(2))
print(np.std(scores).round(2))
print("sample std:", np.std(scores, ddof=1).round(2))18.01 18.01 sample std: 20.13
Reading a standard deviation
A small standard deviation means the values huddle close to the mean. A large one means they're spread out. City A from before has a standard deviation under one degree. City B's is over eleven. Standard deviation is the most used measure of spread in all of statistics, and in machine learning.
| key | value |
|---|---|
| std | √variance |
| Units | same as the data |
| Small | values huddle together |
| Large | values spread out |
Summary
The standard deviation is the square root of the variance, in the same units as the data. Next, percentiles, and where a value ranks.
Key takeaways- std = √variance
- np.std
- Same units as the data