PadhaikoAll subjects

Past exam question: 2081 Chaitra (Regular), Q4(b)

Foundation of Data Science · 4 marks

Open in the Padhaiko app

Topic: Cleaning, Wrangling, Enrichment, Validation & Publishing

Question

How do you handle missing data during data preprocessing? Briefly explain two methods illustrating with a small sample data example.

Solution

Overview of Missing Data in Preprocessing: Real-world datasets frequently contain missing values (represented as NaN, null, or blank cells) caused by equipment sensor failure, survey non-responses, or transmission drops. Because most machine learning algorithms cannot natively process missing numbers, handling them during preprocessing is critical to prevent pipeline failure and biased estimations.

The two most fundamental strategies are:

  1. Listwise (Row) Deletion: Discarding any sample record containing one or more missing feature values.
  2. Mean / Median Imputation: Replacing missing values with a central tendency statistic computed from the available observed values of that feature.

Sample Dataset Illustration: Consider a small academic dataset recording student study hours and exam scores, where Student has a missing exam score:

Student IDStudy Hours ()Exam Score ()
1255
2470
35NaN
4785
5890

Method 1: Listwise (Row) Deletion:

Method 2: Mean Imputation:

The missing score for Student is imputed with .

Answer:

Missing data is primarily handled by:

  1. Listwise Deletion: Removing any row containing missing values. In the sample, Student (NaN) is eliminated, leaving 4 complete records.
  2. Mean Imputation: Replacing the missing entry with the average of observed entries. In the sample, the observed mean score is , imputing Student 's score as while retaining all 5 records.

All past exam questions for Foundation of Data Science