Missing data is one of the most common real-world problems.
๐ First Question:
Why is the data missing?
- Random? โ safer to fix
- Systematic? โ more dangerous
๐งน Method 1: Removal
Delete rows or columns with missing values.
โ Use when:
- Only a small portion of data is missing
โ Avoid when:
- You lose too much data
Example:
If only 2 out of 1000 rows have missing values โ safe to delete
๐ง Method 2: Imputation (Filling Missing Values)
Instead of deleting, you fill in the missing values.
๐ Common Techniques:
1. Mean (Average)
- Best for: numerical data without outliers
- Example: Replace missing salary with average salary
2. Median
- Best for: skewed data (safer than mean)
- Example: income data
3. Mode
- Most frequent value
- Best for categorical data
4. Default Value
- Example:
- Missing city โ “Unknown”
- Missing score โ 0
๐ก Key Insight:
- Mean is sensitive to outliers
- Median is more robust
- Choose based on data distribution