Skip to content
RED SAGSkills
easyData Scientist interview question

How do you handle missing values in a dataset?

What the interviewer wants to hear

  • First understand why data is missing
  • Options: drop, impute (mean, median, model), or flag
  • Missingness itself can be informative
  • Fit imputation on training data only

Model answer

First I find out how much is missing and why. If a value is missing because of a tracking bug on one app version, that is a data quality issue to fix, not just fill. If it is missing for a reason, like "last purchase date" being empty for users who never bought, the missingness itself carries meaning. Then I choose. If very few rows are affected and they look random, dropping them may be fine. For numeric features I often impute the median and add a binary "was missing" flag so the model can learn from it. For categories I add an "unknown" value. Sometimes model-based imputation helps. Many tree models handle missing values directly. For modelling, I fit any imputation on the training set only, to avoid leakage, and check that results do not change much with different choices.

Can you answer it under time pressure?

Take a timed easy round and get scored on every answer.

Start mock interview

More easy Data Scientist questions