On Sun, 10 Jun 2018 21:28:02 +0200, Anders Munch wrote:

> Richard Damon wrote:
> 
>> The two behaviors that I have heard suggested are:
>>
>> 1) If any of the inputs are a NaN, the median should be a NaN.
>> (Propagating the NaN as indicator of a numeric error)
>>
>> 2) Remove the NaNs from the input set and process what is left. If
>> nothing, then return a NaN (treating NaN as a 'No Data' placeholder).
> 
> 3) Raise an exception.
> 
> I can't believe anyone even suggested 2).  "In the face of ambiguity,
> refuse the temptation to guess."

It is not a guess if the user explicitly specifies that as the behaviour.

It would be no more of a guess than if the user called

data = [x for x in data if not math.isnan(x)]

on their data first.



-- 
Steven D'Aprano
"Ever since I learned about confirmation bias, I've been seeing
it everywhere." -- Jon Ronson

-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to