Data ScienceBeginner12 min readUpdated March 2025
Descriptive Statistics
Descriptive statistics summarize a dataset with a few meaningful numbers. Learn measures of center, spread and shape, and when each one is the right choice.
Measures of Central Tendency
These describe the "typical" value:
- Mean — The arithmetic average. Sensitive to outliers.
- Median — The middle value. Robust to outliers; good for skewed data like income.
- Mode — The most frequent value. Useful for categorical data.
Measures of Spread
Spread tells you how much values vary around the center:
- Range — Max minus min.
- Variance and standard deviation — Average squared / typical distance from the mean.
- Interquartile range (IQR) — Q3 minus Q1; the spread of the middle 50%.
Computing Statistics
A single outlier can pull the mean far from the median — a good reason to look at both:
python
import numpy as np
from scipy import stats
salaries = np.array([48, 52, 50, 55, 53, 51, 49, 400]) # in thousands
print("mean :", salaries.mean()) # 94.75
print("median :", np.median(salaries)) # 51.5
print("std :", salaries.std(ddof=1).round(2))
q1, q3 = np.percentile(salaries, [25, 75])
iqr = q3 - q1
outliers = salaries[(salaries < q1 - 1.5 * iqr) | (salaries > q3 + 1.5 * iqr)]
print("outliers:", outliers) # [400]
print("skew :", stats.skew(salaries).round(2))Shape: Skewness and Kurtosis
Skewness measures asymmetry (right-skewed data has a long tail of large values). Kurtosis measures how heavy the tails are. Both guide whether a transformation or a robust statistic is appropriate.
Key Takeaways
- Use the median for skewed data or data with outliers.
- Standard deviation and IQR quantify spread.
- The 1.5 x IQR rule is a quick outlier check.
- Report center and spread together, never one alone.
Contact Us
Have a question or feedback? Fill out the form below or reach us directly at support@nvaitraining.com