Data Scientist Interview Question

How do you decide what to do with missing values in a dataset?

What the interviewer is probing, how to structure your answer, and a spoken example you can adapt.

Quick answer

Start by finding out why the values are missing, since the mechanism decides the fix. Missing completely at random tolerates simple imputation; missing at random needs imputation conditional on observed variables; missing not at random means the missingness itself is signal and should become a feature. Never impute before splitting, and add a was missing indicator whenever the pattern carries information.

Why interviewers ask this

Weak candidates jump straight to mean imputation. The interviewer is checking whether you investigate the cause first, because in real systems missingness is usually a broken pipeline, an optional form field, or a field that only exists for one customer segment, and each of those implies a different action. They also want to hear that imputation gets fit on training data only, since fitting on everything leaks.

How to structure your answer

  • Ask why the data is missing before deciding how to fill it.
  • Map the three mechanisms to three different responses.
  • Say that the missing flag is often a strong feature on its own.
  • Note that imputation is fit inside the training fold.

Example answer

Spoken example, first person

The first thing I do is not statistical, it is a conversation with whoever owns the field. Missing usually means something specific. On a credit dataset I worked on, income was blank for about a fifth of the rows, and those turned out to come through a fast track application flow that never asked for it. That is not random at all, and those applicants defaulted at a different rate, so the fact of the blank was one of the strongest predictors in the model. I added an is missing flag and it earned its place. Mechanically, if it really is random noise and the column is mostly complete, median imputation plus a flag is fine. If it depends on other observed variables, I use iterative or model based imputation. If more than about half a column is missing I usually drop it, because at that point I am mostly imputing my own assumptions. And whatever I use gets fit on the training split only and then applied to validation, because computing a median over the whole dataset quietly leaks.

Walking into this interview soon? GhostPilot listens to your live call, spots the question the moment it is asked, and puts a structured answer on your screen in real time. Try it on your next mock, or grab a $29 Session Pass, no subscription, for the real thing.

See how it works

Follow-up questions to expect

  • How do gradient boosted trees handle missing values natively?
  • What goes wrong if you impute before splitting?
  • How would you handle a feature that is missing only for new customers?

Related data scientist questions

Your interviewer will ask their own version of this. Paste your actual job description into the free Question Predictor and get the 20 questions that role is most likely to ask, with what each one is really probing.

Predict my questions

Rehearse the hard questions before they are asked

Practise with a live copilot, then walk in ready. A $29 Session Pass gets you through the interview with no subscription and no lock-in.

Get GhostPilot