Menu

Missing Values and Their Meaning

Lesson 2: Missing Values and Their Meaning

Why can data be missing?

Reason

Example

Question not askedOlder survey version didn't include "age"
Respondent skipped itCustomer declined to share income
System failureTracking broke for two days
Not applicable"Cancellation date" for active customers
Data integration gapField not mapped when merging systems

The reason matters because missingness can be related to the outcome you're studying.

Types of missingness:

Type

Meaning

Example

Risk

MCAR – Missing Completely At RandomMissingness unrelated to anythingRandom server glitchLow bias
MAR – Missing At RandomRelated to other observed variablesMobile users skip a field more oftenManageable if you account for the related variable
MNAR – Missing Not At RandomRelated to the missing value itselfHigh earners hide their incomeHigh bias

How to inspect missingness

  • Count missing values by column.
  • Calculate the percentage missing.
  • Check missingness by subgroup: time period, region, device, customer segment.
  • Visualise with a heatmap of missing values (e.g., the missingno library).
df.isna().mean().sort_values(ascending=False) # % missing per column
df.groupby('device')['income'].apply(lambda s: s.isna().mean()) # by subgroup

Ways to handle missing values

Approach

Pros

Cons

Leave missingHonest; no invented dataSome tools can't handle NaN
Exclude from a specific calculationSimpleReduces sample size; may bias
Drop rows (listwise deletion)SimpleLoses data; biased if not MCAR
Mean / median imputationKeeps rowsShrinks variability; distorts relationships
Group-based imputationMore realistic (e.g., median by region)Still an estimate
Forward / backward fillSuits time seriesWrong for non-sequential data
Model-based imputationUses relationships between variablesMore complex; can overfit
Add a "missing" flagPreserves information that data was missingAdds columns
Fix at sourceBest long-termTakes time

Example

  • If income is missing more often among respondents who decline sensitive questions (MNAR), filling every gap with the overall average creates a misleading picture.
  • Better: report the missing share, compare responders with non-responders on other variables, and state whether the remaining sample may be biased.

Common mistakes

  • Assuming missing means zero.
  • Not documenting how many values were affected.
  • Not comparing results before and after a major imputation decision.
  • Imputing the target variable in a model.

Data Analytics Tutorial



Learn via Video Course

Data Analysis and Processing with Python using Pandas - Data Science Course Logo

Data Analysis and Processing with Python using Pandas - Data Science Course

5 hrs



Get in Touch For Details