A data scientist is working with a dataset containing two columns with missing values: temperature_reading (a continuous numeric feature with a symmetric, bell-shaped distribution) and product_color (a nominal categorical string feature). Which combination of imputation strategies is most appropriate for each column?
Answer & explanation
Correct answer: D
WHY D: For temperature_reading — a symmetric continuous distribution — the mean equals the median and is the most efficient unbiased estimator of central tendency, making it appropriate for imputation. For product_color — a nominal categorical feature — arithmetic operations like mean and median are undefined; only the mode (most frequent category) is a valid measure of central tendency for nominal data. WHY NOT A: Using mode for a symmetric continuous feature ignores the full distributional information; using mean of label-encoded nominal categories is statistically invalid because integer codes have no numeric meaning. WHY NOT B: The median cannot be meaningfully computed for nominal categorical strings; PySpark's Imputer explicitly does not support categorical (string) columns. WHY NOT C: Same problem as A — computing mean of label-encoded nominal values produces results that depend entirely on arbitrary encoding order and are statistically meaningless. WHY NOT E: While mean is PySpark Imputer's default, the documentation explicitly warns that the Imputer does not support categorical features and may produce incorrect values for them; applying mean imputation to nominal string columns is incorrect.