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