Art of DS

Appearance

Palette
Theme
Unlock $20 one time
Sign in, or create an account

Sign in to Art of DSCreate your Art of DS account

We email you a link and a six-digit code. Either one signs you in; there is no password.Enter your email. We send a link and a six-digit code to confirm it — no password to remember. The account is free.

  • You come back to this page, right where you were.
  • Already have an account? The same email simply signs you in.

By continuing you accept the Terms and the Privacy policy.

Your account

Free accountLifetime access

Machine learning · 5 compared

Missing-data methods

Definition

Dropping rows and filling gaps are both decisions about the answer. Which one is safe depends on why the values are missing, and on which number you report.

Comparison

Name What it does Under MAR Spread and relationships Uncertainty
Complete case Drop every row with a gap. Costs only sample size when the gaps are random; otherwise it changes who is left. Full page →mean wrong, slope rightkepthonest, on fewer rows
Mean imputation Fill each gap with its column's average. Puts a spike at the centre and weakens every relationship the column is in. Full page →mean wrong, slope shrunkshrunkunderstated
Regression imputation Predict each gap from the other columns. Recovers what those columns explain, and puts every filled point on the line. Full page →mean and slope recoveredrelationships overstatedunderstated
Regression + residuals The same prediction, plus a residual drawn from the observed rows, so the filled points scatter like real ones. Full page →mean and slope recoveredkeptunderstated
Multiple imputation Impute several times with different random draws and combine, so the analysis sees how unsure the filled values are. Full page →as its imputer allowskeptcarried through

On the cheat sheet: Missing data and outliers →

Drop or fill

Dropping incomplete rows "comes at the price of losing data which may be valuable (even though incomplete)"; the alternative is to impute, "to infer them from the known part of the data" [1, §8.4]. Neither can invent what was never recorded, and both change the answer when the gaps are not random.

Why the values are missing decides the row

Missing completely at random, every row here is safe for the mean. Missing because of another column you have, a model of that column recovers the answer. Missing because of the value itself, no row recovers it: the information left with the deleted values. The missing data page measures all three.

Reading the rows

Filled values look like observed ones. Filling a series with a smooth estimate "understates the noise in the series", and the remedy is "adding in resampled residuals" [2, §12.5]: the difference between the third and fourth rows.

A single imputation understates uncertainty. scikit-learn's iterative imputer returns a single imputation, and "can also be used for multiple imputations by applying it repeatedly to the same dataset with different random seeds when sample_posterior=True" [1, §8.4.3.2].

Keep the gaps visible. "When using imputation, preserving the information about which values had been missing can be informative" [1, §8.4.6]: add the indicator column whichever row you choose.

Sources

  1. scikit-learn User Guide — Imputation of missing valuesdocs · retrieved 2026-10-24https://scikit-learn.org/stable/modules/impute.html
  2. Downey. Think Statsbook · retrieved 2026-10-24https://greenteapress.com/thinkstats2/html/thinkstats2013.html

Have a promo code?

A code that takes 100% off unlocks everything at once. A smaller one takes its share off the price in the payment window: enter the same code there.

Write to support

A question, a problem with access, a refund? Write to us and we answer by email.

What is it about?

Your address is used only to answer you.

Message sent

Thank you. We will reply to the address you gave, by email.

Or write to us directly

support@artofds.com

Message sent Thank you. We will reply to the address you gave, by email.

Check the email address: we need it to reply.

That is our own address. Enter yours, so the reply reaches you.

This address cannot receive email. Check it for a typo.

Write a little more: at least 10 characters.

Too many messages in a short time. Try again in a few minutes.

The message could not be sent. Please write to us directly: support@artofds.com