Read the observationsLesson 15 of 30 · 6 min
What happened to the missing rows?
Explain how selective missingness changes an estimate and retain outcome counts.
A missing value records an observation you do not have. It is different from zero. A timeout is an outcome with incomplete timing information, not a zero-millisecond success.
In this invented request table, two long-running requests are represented as timeouts. pandas ignores missing values when computing a mean by default. The resulting value is the mean among recorded successful times, not the mean time of every offered request.
If you stop waiting at 200 ms, a timeout tells you the request took longer than that boundary or failed under that rule. Treating it as exactly 200 ms would add an assumption. Report successful, failed and unfinished counts, the timeout rule and the boundary of any timing summary. Different missing-data mechanisms need different analyses.
Will the default mean include the two timeout rows?
Write a prediction (optional)
Run the prepared example
This page puts the example in the Python editor. Select Run Python with the code unchanged.
Invented data
A saved draft is open. To run the published example, open Editor tools and select Restore example. Recover draft brings your code back.
Execution error
Technical error details
What to compare
Find Offered requests and Outcome counts. Compare the table’s elapsed_ms entries with Mean among recorded times (ms). Which requests does that mean leave out?
Your result
Result tools
The average uses only four recorded times. The other two requests timed out and contribute to the outcome counts, but supply no recorded time.
Published example output
The site ran the original code to produce this reference. Build environment ↗
request status elapsed_ms
1 ok 80.0
2 ok 90.0
3 timeout NaN
4 ok 85.0
5 timeout NaN
6 ok 95.0
Offered requests: 6
Outcome counts: {'ok': 4, 'timeout': 2}
Mean among recorded times (ms): 87.5
The average uses only four recorded times. The other two requests timed out and contribute to the outcome counts, but supply no recorded time.
Change and run again
In the Python editor, change the final data.elapsed_ms.mean() to data.elapsed_ms.fillna(0).mean() and rename its printed label to Mean treating timeouts as zero (ms). Select Run Python again. Compare that number and Outcome counts with the first run. Why did the mean fall without a change in outcomes? Return to the Python editor
What this example supports. The mean omits unrecorded times. Estimating time across all offered requests would need a method that accounts for the timeout rule.
Try a fresh case
A trial loses follow-up mainly among participants with severe symptoms. What is the concern?
Hints for this question
- Ask whether missing and observed cases differ systematically.
- A larger complete-case sample does not reveal the missing outcomes.