[Python-ideas] NAN handling in the statistics module
jfine2358 at gmail.com
Mon Jan 7 09:01:34 EST 2019
Happy New Year (off topic).
Based on a quick review of the python docs, the bug report, PEP 450
and this thread, I suggest
1. More carefully draw attention to the NaN feature, in the
documentation for existing Python versions.
2. Consider revising statistics.py so that it raises an exception,
when passed NaN data.
The proposed statistics module is motivated by the "batteries
included" philosophy towards the Python standard library. Raymond
Hettinger and other senior developers have requested a quality
statistics library that falls somewhere in between high-end statistics
libraries and ad hoc code. Statistical functions such as mean,
standard deviation and others are obvious and useful batteries,
familiar to any Secondary School student.
The PEP makes no mention of NaN. Was it in error, in not stating that
NaN data is admissable? Is NaN part of the "batteries familar to any
Secondary School student?".
This module provides functions for calculating mathematical statistics
of numeric (Real-valued) data.
Some people regard NaN as not being a real-valued number. (Hint:
There's a clue in the name: Not A Number.)
Note that statistics.py already raises StatisticsError, when it
regards the data as flawed.
Finally, I suggest that we might learn from
Fix some special cases in Fractions?
I'll put a brief summary of my message into the bug tracker for this issue.
More information about the Python-ideas