Does filling missing values restore the data?
A column has two blank cells. Replacing them makes the table complete—but does it restore the information you lost?
Our original eight values are 2 through 9. We hide two values and retain the originals only as teaching evidence. Imagine these are training records. In a real dataset, the missing originals would usually be unknown.
Keep the missingness fixed
Start with and . Predict the observed mean compared with the original mean of 5.5. Record the reference.
Keep the same two values hidden. Change only the treatment to , then in a separate run to . Predict the column mean and remaining blank count before each run.
Eight synthetic training records with original values 2 through 9. Hide exactly two. Fill values use only observed entries; original values are teaching-only ground truth. There is no model or held-out evaluation in this demonstration.
0/16 runs. Each run keeps its own inputs and results. Work stays in this tab across reloads; download a report before closing it.
Write a prediction to record your reference.
Use the calculated records to compare inserted values with the teaching-only originals. Explain what a complete table does and does not establish.
What the filled table tells us
Hiding 8 and 9 leaves 2 through 7, whose mean is 4.5. Zero filling gives . Mean filling inserts 4.5 twice, giving .
Mean filling preserves the observed mean here, but the complete original mean was 5.5. The imputed values do not recover 8 and 9. Median filling also inserts 4.5 for this symmetric observed subset; that equality need not hold in another dataset.
Missing is not zero
Zero is a measured value with meaning. A missing marker means the value is unavailable. A summary should say how many observations it used rather than quietly interpreting blanks as zeros.
A simple imputer can fill entries with an observed mean, median, or chosen constant. The choice adds assumptions; it does not reveal the missing truth. Scikit-learn documents these imputation strategies. In a training workflow, fit such statistics on training observations and apply the same fitted rule to validation observations; lesson six investigates why.
Design a comparison
Keep mean filling fixed and choose another missingness pattern. Predict whether the estimated mean will now be too high, too low, or equal to the original mean. Use to compare with your earlier mean-filled run.
Then hold your new pattern fixed and choose another treatment. Name the assumption you would need to justify using it on real records. Download your observations and proposed next test.
Check the missingness argument
Hiding the two lowest values leaves a mean of 6.5. Hiding one low and one high value, 3 and 8, leaves a mean of 5.5. The same number of blanks can yield different bias because different observations disappeared. In real data, inspect collection processes and missingness across groups; the count of blanks alone cannot identify the mechanism.
Continue
Previous lesson · Next: Are twelve records twelve independent examples? · All statistics lessons