Steven D'Aprano wrote:
> Marco, you don't have to use median_low and median_high if you don't
> like them, but they aren't any worse than any other choice for
> calculating order statistics. All order statistics (apart from min and
> max) require you to sometimes make a choice between returning a data
> value or interpolating between two data values, and in general there are
> lots of choices.
Of course, but usually they are unbiased solutions by default. On the contrary,
if you don't have numeric iterables, you have to choice between median_low and
median_high, that introduce bias. And since the module is called `statistics` I
think it's very important to not introduce biases. My function correct this.
Furthermore, with my function you can simply pass this function as key
parameter for sorted:
@functools.cmp_to_key
def iliadSort(a, b):
if a < b:
res = -1
elif not b == b:
res = -1
else:
res = 0
return res
and NaNs are moved at the end of the list.
_______________________________________________
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at
https://mail.python.org/archives/list/[email protected]/message/M3DEOZLA63Z5OIF6H6ZCEXK36GQMLVVA/
Code of Conduct: http://python.org/psf/codeofconduct/