Interview Q&A / Data Science
Data Science interview questions
Statistics, pandas, cleaning data and exploratory analysis for analyst and data science roles.
Prefer rapid revision? Practise Data Science short interview answers →
- How do you detect outliers using the IQR and z-score methods?
With the IQR method, a value is an outlier if it lies below Q1 minus 1.5 times the IQR or above Q3 plus 1.5 times the IQR. With the z-score method, a value is flagged if it is more than about 3 standard deviations from the mean. IQR is more robust for skewed data and small samples, because outliers inflate the mean and standard deviation.
IntermediateIn-depth4 min read - How do you handle missing values in a dataset?
First find how much is missing and why. Then either drop rows or columns (when little is missing or a column is mostly empty) or fill the gaps, using the median for skewed numbers, the mode for categories, forward fill for time series, or a model-based method. Often add a flag column that records which values were missing.
IntermediateIn-depth4 min read - How do you find and handle missing values in pandas?
Use isna().sum() to count them, then dropna to remove rows or columns, or fillna to fill them with a constant, mean, median or group value. Check what share is missing first, since the right fix depends on it.
BeginnerQuick answer1 min read