[Numpy-discussion] nan, sign, and all that
Stéfan van der Walt
stefan at sun.ac.za
Thu Oct 2 03:37:12 EDT 2008
Hi Charles,
2008/10/2 Charles R Harris <charlesr.harris at 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.])
Cheers
Stéfan
More information about the NumPy-Discussion
mailing list