[Numpy-discussion] nan, sign, and all that

Stéfan van der Walt stefan@sun.ac...
Thu Oct 2 02:37:12 CDT 2008

Hi Charles,

2008/10/2 Charles R Harris <charlesr.harris@gmail.com>:
> In [3]: a = array([NAN, 0, NAN, 1])
> In [4]: b = array([0, NAN, NAN, 0])
> In [5]: fmax(a,b)
> Out[5]: array([  0.,   0.,  NaN,   1.])
> In [6]: fmin(a,b)
> Out[6]: array([  0.,   0.,  NaN,   0.])

These are great, many thanks!

My only gripe is that they have the same NaN-handling as amin and
friends, which I consider to be broken.  Others also mentioned that
this should be changed, and I think David C wrote a patch for it (but
I am not informed as to the speed implications).

If I had to choose, this would be my preferred output:

In [5]: fmax(a,b)
Out[5]: array([  NaN,   NaN,  NaN,   1.])


More information about the Numpy-discussion mailing list