Treatment of NANs in the statistics module

Rustom Mody rustompmody at gmail.com
Sun Mar 18 09:55:39 EDT 2018


On Saturday, March 17, 2018 at 3:22:46 PM UTC+5:30, Léo El Amri wrote:
> On 17/03/2018 00:16, Steven D'Aprano wrote:
> > The bug tracker currently has a discussion of a bug in the median(), 
> > median_low() and median_high() functions that they wrongly compute the 
> > medians in the face of NANs in the data:
> > 
> > https://bugs.python.org/issue33084
> > 
> > I would like to ask people how they would prefer to handle this issue:
> 
> TL;DR: I choose (5)

Just like to point out that 5 is really 5a and 5b
5a One can give the option at the function call point
5b One can set a module level flag:
See how pandas sets 'pandas.options. ...' for similar choices
https://pandas.pydata.org/pandas-docs/stable/missing_data.html

I guess I'd go for 5b even though it makes the code less 'functional' in the 
sense of FP — ie the same (looking) function call can have different effects



More information about the Python-list mailing list