NumPy has enough statistics built in to describe a dataset without any extra library — the summary numbers you compute constantly plus histograms, which turn raw values into a distribution.
Central tendency & spread
data = rng.normal(60, 15, 1000)data.mean() # averagenp.median(data) # middle value (robust to outliers)data.std() # standard deviationnp.percentile(data, [25, 75]) # the quartiles
Correlation & histograms
np.corrcoef(hours, scores) # correlation matrix (−1 to +1)counts, edges = np.histogram(data, bins=10) # distribution shape
Key takeaways
- 01mean/median/std/percentile summarise centre and spread.
- 02Median and IQR are robust to outliers; prefer them for skewed data.
- 03np.corrcoef measures how strongly two variables move together (−1 to +1).
- 04np.histogram counts values per bin to reveal a distribution's shape.
