Handling missing numerical values
judgment about imputation trade-offs.
dropping rows is simple but loses data and can bias if missingness is non-random; mean or median imputation keeps rows but shrinks variance and ignores correlations; model-based imputation is…
What's really being asked
The interviewer wants to see structured reasoning about the bias-variance and data-loss trade-offs of imputation, plus awareness of why missingness arose. It is a judgment question, not a recipe.
The full answer
First, deletion: dropping rows with missing values is trivial and keeps the remaining data untouched, but it discards information and produces biased estimates unless values are missing completely at random. Second, simple imputation with the mean or median: this retains every row and is fast, but it artificially reduces variance, weakens correlations with other features, and the mean is sensitive to outliers so the median is often safer for skewed columns. Third, model-based imputation such as KNN or iterative regression imputation predicts the missing value from other features, capturing relationships and giving more realistic fills, at the cost of complexity, runtime, and leakage risk if not fit only on training data. Adding a binary missingness-indicator column can also preserve the signal that a value was absent.
The mistakes people make
Always using the mean regardless of skew or outliers. Imputing before splitting into train and test, which leaks information. Dropping columns or rows without checking how much data is lost or why it is missing. Ignoring that missingness itself may be predictive.
What usually comes next
Define missing completely at random, missing at random, and missing not at random. How does imputation interact with cross-validation. When would you prefer to add a missingness flag.
A concrete example
In a salary column where high earners decline to report, the data is missing not at random. Mean imputation would pull missing entries toward the average and understate true top salaries, biasing any downstream model. A better choice is model-based imputation plus a missingness indicator, so the model learns both an estimate and the fact that the value was withheld.
Interview question
Why is mean imputation often a poor default for a heavily skewed numerical column?
- a.It is pulled by outliers and shrinks the column's varianceCorrect
- b.It is computationally infeasible on large data
- c.It removes too many rows from the dataset
- d.It requires labeling missingness as a separate class
Why? this is the answer
The mean is sensitive to outliers in skewed data and filling with one constant reduces variance and distorts correlations; the median is more robust. Mean imputation keeps all rows rather than removing them.
Just read this? Test yourself on what you have been reading.
Read the original → scirp.org
- #imputation
- #missing-data
- #preprocessing
- #data-cleaning
- #statistics
Put your scrolling time to good use
Learn one idea, try a quiz and save useful cards for revision. Tezvyn makes it easy to learn and stay current in your tech field, a few minutes at a time.
The iPhone app is on the way
We are building it. Until it lands, nothing here is held back from you: every interview card, your saved cards, streaks and the job board all work in Safari, plus hundreds of free practice quizzes of thirty questions each. Sign in and it all carries over to the app the day it arrives.
Want it as an icon? Tap Share at the bottom of Safari, then Add to Home Screen. It opens full screen and the cards you have read stay available offline.
We are hiring for this. Every open role lists the topics its interview covers, so you can prepare for the real thing rather than guessing.
See open roles