Think Build Implement Repeat
London, UK +44 7367 067226
WhatsApp FOLLOW f in X
  1. Home
  2. Blog
  3. Handling Missing Data Without Inventing It
AI & Machine Learning

Handling Missing Data Without Inventing It

Filling blanks with the average is the default and often wrong. Why a field is missing usually carries information, and what to do instead.

Updated 2 min readBy SpiderHunts Technologies

Free estimateNo obligation

Get a free estimate

Tell us what you need. A senior engineer reads every enquiry.

Takes under a minute. We never share your details.

  • Free consultation
  • No commitment
  • NDA on request

Prefer to talk? Book a free 30-minute call →

Quick answer — TL;DR

Why a value is missing matters more than how you fill it. In business data, missingness is usually not random - it reflects a process - and the fact that a field is blank is often itself predictive. Record it explicitly rather than quietly imputing it away.

Missing is not random in business systems

Statistical texts distinguish data missing at random from data missing for a reason. Business data is almost always the second. A blank field usually means a process did not happen.

  • No delivery date because the order was never despatched
  • No phone number because the customer refused to give one
  • No credit score because the check was skipped for a small order
  • No inspection result because the item passed and only failures are recorded
  • No discount because the sale went through at list price

In each case the blank carries information. Replacing it with an average destroys that information and can invert the meaning entirely - imputing an average credit score for customers who were never checked treats them as typical when they were systematically different.

Add a flag before you fill anything

The most useful single technique is also the simplest: for any field with meaningful missingness, add a was_missing indicator alongside it. Fill the value however you like, and let the model use the flag to learn what the blank meant.

This costs one column and preserves information that every imputation method otherwise discards. Where the missingness is predictive, the flag frequently turns out to be among the more useful features.

Choosing a fill when you need one

ApproachReasonable whenRisk
Leave as missingThe model handles it nativelyNot all do
Zero or a sentinelMissing genuinely means noneConfused with a real zero if not flagged
Median or modeMissing is incidental and rareShrinks variance, hides the pattern
Predict from other fieldsFields are strongly relatedLeakage risk; adds a model to maintain
Carry last value forwardTime series where state persistsInvents stability that may not exist

Several modern algorithms handle missing values directly and often better than imputation. That is usually the first thing to try before building anything elaborate.

The leakage trap in imputation

Imputing with a statistic calculated across the whole dataset leaks information from test into training, and from the future into the past. The fill must be calculated on training data only and applied to everything else.

For time series this is stricter still: the fill for a given date must use only data available before it. This is a common source of backtests that cannot be reproduced live, as covered in our note on backtesting a forecast.

When too much is missing

Sometimes the honest answer is that a field cannot be used. If a column is 80% blank and the missingness correlates with the outcome, no imputation strategy rescues it - anything you fill in is largely invention.

Better to drop it, note why, and if it matters, fix the process that leaves it blank. A field properly captured from now on becomes usable within a year, which is often faster than it sounds.

Imputing a value does not create information. It only hides that you had none.

FAQ

Frequently asked questions

The questions readers ask us after this guide.

Still have a question?

Ask us directly — a senior engineer will get back to you.

Ask about your project

Is it ever fine to fill with the mean?

For a field with a small amount of genuinely incidental missingness, yes. Add the missing flag anyway - it costs nothing.

Should rows with missing values be dropped?

Rarely. Dropping them usually removes a non-random group and biases the model towards customers or transactions with complete records.

How do I tell if missingness is informative?

Compare the outcome rate for rows where the field is present against those where it is absent. A clear difference means the blank is carrying information.

Do modern algorithms need imputation at all?

Several handle missing values natively and often better than manual filling. Try that first before building an imputation pipeline.

Keep reading

More on AI & Machine Learning

Start here

Want machine learning project details from us?

Tell us what you are trying to predict and roughly what data you hold. We will come back with an honest view on whether machine learning is the right tool, what the work would involve and a realistic cost range. If a spreadsheet would do the job, we will say so.

  1. You tell us what you needTwo minutes on the form, or a message on WhatsApp.
  2. A senior engineer reviews itAnd comes back with questions, a realistic range and an honest view on fit.
  3. Free 30-minute scoping callWe talk through scope, options and a realistic estimate — with no obligation.
Free estimateNo obligation

Talk to someone who builds this

Send a short brief and we will come back with an honest view and a realistic range.

Takes under a minute. We never share your details.

  • Free consultation
  • No commitment
  • NDA on request

Prefer to talk? Book a free 30-minute call →