Simple Imputation: Mean, Median, and Mode
You'll learn how to fill in missing values using three basic statistical measures and when each method works best.
The Core Idea
When you have missing data in your dataset, one straightforward solution is simple imputation—replacing each missing value with a summary statistic calculated from the available (non-missing) values in that feature. The three most common choices are:
- Mean: the average of all non-missing values
- Median: the middle value when sorted
- Mode: the most frequently occurring value
Think of it like filling in blanks on a survey. If someone didn't answer "age," you might guess their age is around the average age of everyone who did answer.
When to Use Each Method
Mean imputation works well for normally distributed numerical data without outliers. It preserves the overall average but can distort variance.
Median imputation is better when your data has outliers or is skewed. Since the median isn't affected by extreme values, it's more robust. If you're filling in missing house prices and a few mansions exist in your dataset, median is safer than mean.
Mode imputation is ideal for categorical variables (like "color" or "city") or discrete counts. You simply fill missing values with the most common category.
Important Caveat
All simple imputation methods assume data is Missing Completely at Random (MCAR). They reduce variance in your dataset and can introduce bias if missingness has a pattern. Despite these limitations, they're fast, interpretable, and often used as a baseline.
Key Takeaway: Simple imputation fills missing values with mean (for symmetric numerical data), median (for skewed/outlier-prone data), or mode (for categorical data)—quick solutions that work best when missingness is random.