[Numpy-discussion] Medians that ignore values

David Cournapeau david@ar.media.kyoto-u.ac...
Fri Sep 19 23:08:13 CDT 2008


Robert Kern wrote:
> On Fri, Sep 19, 2008 at 22:25, David Cournapeau
> <david@ar.media.kyoto-u.ac.jp> wrote:
>   
>
> How, exactly? ndarray.min() is the where the implementation is.
>   

Ah, I keep forgetting those are implemented in the array object, sorry
for that. Now I understand Stefan point. Do I understand correctly that
we should then do:
    - implement a min/max NaN aware for every float type (real and
complex) in umathmodule.c, which ignores nan (called @TYPE@_nanmin, etc...)
    - fix the current min/max to propagate NaN instead of giving broken
result
    - How to do the dispatching ? Having PyArray_Min and PyArray_NanMin
sounds the easiest (we don't change any C api, only add an argument to
the python-callable function min, in array_min method ?)

Or am I missing something ? If this is the right way to fix it I am
willing to do it (we still have to agree on the default behavior first).
I am not really familiar with sort module, but maybe it is really
similar to min/max case.

cheers,

David


More information about the Numpy-discussion mailing list