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 →
- What are variance and standard deviation, and why do we need them?
Variance is the average of the squared distances from the mean, and standard deviation is its square root. They measure how spread out the data is. Two datasets can have the same mean but very different spread, and standard deviation is easier to read because it is in the same units as the data.
BeginnerIn-depth3 min read - What is the difference between correlation and causation?
Correlation means two variables move together. Causation means a change in one actually produces a change in the other. Correlation can come from a hidden third factor, from chance, or from cause running the other way, so proving causation usually needs a controlled experiment such as an A/B test.
BeginnerIn-depth3 min read - What is the difference between mean, median and mode, and when is the median better?
The mean is the sum divided by the count, the median is the middle value after sorting, and the mode is the most frequent value. Use the median when the data is skewed or has outliers, like salaries, because one very large value pulls the mean up but barely moves the median.
BeginnerIn-depth4 min read - What is the difference between merge, join and concat in pandas?
merge combines two DataFrames on matching column values, like a SQL join. join does the same but matches on the index by default. concat simply stacks DataFrames on top of each other (rows) or side by side (columns) without matching any keys.
BeginnerIn-depth3 min read - What is the difference between normalisation and standardisation?
Normalisation (min-max scaling) squeezes values into a fixed range, usually 0 to 1, using (x - min) / (max - min). Standardisation (z-score scaling) shifts values to mean 0 and standard deviation 1, using (x - mean) / std. Standardisation handles outliers better, and both should be fitted on training data only.
BeginnerIn-depth4 min read - How do you calculate conditional probability from a two-way table?
P(A given B) is the count of A-and-B divided by the count of B. You restrict attention to the rows or columns where B is true and compute the share there. P(A given B) is not the same as P(B given A).
BeginnerQuick answer1 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 - How do you find the probability of at least one success?
Use the complement rule: P(at least one) = 1 - P(none). Computing the chance of nothing happening is much easier than adding up every way that something happens.
BeginnerQuick answer1 min read - How do you read a box plot?
A box plot shows the median, Q1 and Q3 as a box, whiskers reaching the furthest points within 1.5 x IQR of the box, and dots for points beyond that. It summarises centre, spread, skew and outliers in one compact picture.
BeginnerQuick answer1 min read - How does groupby work in pandas?
groupby splits the rows into groups by key, applies a function such as sum or count to each group, and combines the results into a new object. Named aggregation lets you compute several summaries in one call.
BeginnerQuick answer1 min read - What are the main sampling methods: simple random, stratified, cluster and systematic?
Simple random gives everyone an equal chance; stratified splits the population into groups and samples each; cluster picks whole groups at random; systematic takes every kth item. Each trades cost against precision.
BeginnerQuick answer1 min read - What are Type I and Type II errors in hypothesis testing?
A Type I error is a false positive: rejecting a true null hypothesis, with probability alpha. A Type II error is a false negative: failing to reject a false null, with probability beta. Power is 1 - beta.
BeginnerQuick answer1 min read - What do the slope and intercept mean in a simple linear regression?
The slope is the average change in y for a one-unit increase in x, and the intercept is the predicted y when x is zero. Least squares picks the line that minimises the sum of squared vertical errors.
BeginnerQuick answer1 min read - What does R-squared tell you, and what does it not tell you?
R-squared is the share of the variation in the target that the model explains, from 0 to 1. It says nothing about whether the model is correct, unbiased or good at predicting new data, and it never decreases when you add features.
BeginnerQuick answer1 min read - What is a percentile, and how is it different from a quartile?
A percentile is the value below which a given percentage of the data falls. Quartiles are just three special percentiles: Q1 is the 25th, Q2 the 50th (the median) and Q3 the 75th.
BeginnerQuick answer1 min read - What is a weighted average, and when should you use it instead of a simple average?
A weighted average multiplies each value by its importance (weight) and divides by the total weight. Use it when items do not count equally, such as marks with different credit values or averaging group means of unequal size.
BeginnerQuick answer1 min read - What is a z-score, and how does it help compare values on different scales?
A z-score is (value - mean) / standard deviation, the number of standard deviations a value sits from the mean. Because it removes units and scale, you can compare a Maths mark with a Physics mark fairly.
BeginnerQuick answer1 min read - What is expected value, and how do you use it to judge a game or decision?
Expected value is the probability-weighted average of all outcomes, the long-run average result of repeating a situation many times. A negative expected value means you lose on average, even if you sometimes win.
BeginnerQuick answer1 min read - What is sampling bias, and what are common types?
Sampling bias happens when the sample systematically differs from the population, so conclusions do not generalise. Common types are selection bias, survivorship bias, non-response bias and convenience sampling.
BeginnerQuick answer1 min read - What is skewness, and what does it tell you about the mean and median?
Skewness measures how lopsided a distribution is. In a right-skewed distribution a long tail of large values pulls the mean above the median; in a left-skewed one the mean falls below the median.
BeginnerQuick answer1 min read - What is the 68-95-99.7 rule for the normal distribution?
In a normal distribution, about 68% of values lie within 1 standard deviation of the mean, 95% within 2 and 99.7% within 3. It gives a fast way to judge how unusual a value is.
BeginnerQuick answer1 min read - What is the Central Limit Theorem, and why does it matter?
The Central Limit Theorem says that the distribution of sample means approaches a normal distribution as the sample size grows, whatever the shape of the original data (given finite variance). That is why normal-based tests and confidence intervals work on messy real data.
BeginnerQuick answer1 min read - What is the difference between independent and mutually exclusive events?
Independent events do not affect each other: P(A and B) = P(A) x P(B). Mutually exclusive events cannot happen together: P(A and B) = 0. Two events with non-zero probability cannot be both.
BeginnerQuick answer1 min read - What is the difference between loc and iloc in pandas?
loc selects by label (index values and column names) and includes the end of a slice. iloc selects by integer position and excludes the end, like normal Python slicing.
BeginnerQuick answer1 min read - What is the difference between MAE and RMSE as regression metrics?
MAE is the average absolute error and treats all errors equally. RMSE squares errors before averaging and takes the root, so large errors count much more. RMSE is always at least as large as MAE.
BeginnerQuick answer1 min read - What is the difference between permutations and combinations?
Permutations count arrangements where order matters; combinations count selections where order does not. Choosing r from n gives nPr = n!/(n-r)! ordered ways and nCr = n!/(r!(n-r)!) unordered ways.
BeginnerQuick answer1 min read - What is the difference between standard deviation and standard error?
Standard deviation describes how spread out individual data points are. Standard error describes how much a sample statistic, usually the mean, would vary from sample to sample, and equals SD divided by the square root of n.
BeginnerQuick answer1 min read - When do you use the binomial distribution?
Use it to count successes in a fixed number of independent trials, each with the same probability of success. The probability of exactly k successes in n trials is C(n,k) p^k (1-p)^(n-k).
BeginnerQuick answer1 min read - When would you use pivot_table instead of groupby in pandas?
pivot_table is groupby with the second key spread across columns, giving a cross-tab style summary. Use it when you want a grid for reading or charting, and groupby when you want a long list of groups.
BeginnerQuick answer1 min read - Why is the range a weak measure of spread?
The range is maximum minus minimum, so it depends only on the two most extreme values. One outlier can change it enormously while the rest of the data is unchanged, which makes it unstable. IQR or standard deviation use more of the data.
BeginnerQuick answer1 min read