[Numpy-discussion] A faster median (Wirth's method)

Sturla Molden sturla@molden...
Wed Sep 2 10:00:10 CDT 2009


Citi, Luca skrev:
> Hello Sturla,
> In "_median" how can you, if n==2, use s[] if s is not defined?
> What if n==1?
>   
That was a typo.



> Also, I think when returning an empty array, it should be of
> the same type you would get in the other cases.
Currently median returns numpy.nan for empty input arrays. I'll do that 
instead. I want it to behave exactly as the current implementation, 
except for the sorting.

Sturla


More information about the NumPy-Discussion mailing list