Covariance and correlation measure how two variables change together. Correlation is the standardised, interpretable version — a number from −1 to +1 that summarises the strength and direction of a linear relationship.
Correlation
import numpy as nphours = [1, 2, 3, 4, 5]scores = [52, 61, 68, 80, 88]np.corrcoef(hours, scores)[0, 1] # ≈ 0.99 — strong positive
A correlation near +1 means the variables rise together; near −1, one rises as the other falls; near 0, no linear relationship. Covariance measures the same idea but in unstandardised units, so it's hard to interpret directly.
Key takeaways
- 01Covariance and correlation measure how two variables move together.
- 02Correlation is standardised: −1 (perfect negative) to +1 (perfect positive), 0 = no linear link.
- 03It captures only linear relationships — a curve can have ~0 correlation.
- 04Correlation does not imply causation; always plot the data too.
