[Numpy-discussion] Medians that ignore values

David Cournapeau david at ar.media.kyoto-u.ac.jp
Thu Sep 18 22:45:56 EDT 2008


Anne Archibald wrote:
>
> I don't think I agree:
>
> In [4]: np.median([1,3,nan])
> Out[4]: 3.0
>
> In [5]: np.median([1,nan,3])
> Out[5]: nan
>
> In [6]: np.median([nan,1,3])
> Out[6]: 1.0
>   

I was referring to the fact that if you have nan in your array, you
should use nanmean if you want to ignore them correctly. Now, the
different behavior depending on the order of items in the arrays is
indeed buggy, I thought this was fixed.

cheers,

David



More information about the NumPy-Discussion mailing list