[Numpy-discussion] comparing arrays with NaN in them.
Fri Aug 24 11:53:51 CDT 2007
Timothy Hochberg wrote:
> in principle it's not safe to rely on NaNs being bitwise equal.
Thanks Tim, I always learn a lot on this list.
Anyway, I think my suggestion of "binary equal" wasn't really what I
want. What I want is essentially a NaN-safe comparison, much like the
NaN-safe functions like nanmax, nanmin, etc.
I guess what that would involve is looping through the arrays, checking
for "==", then checking if both are NaN if it returns false. (or
checking for the NaN's first).
I'm not sure NaNifying the other comparisons would make any sense: NaN >
NaN (and all the other comparison's would have to return False anyway.
So, would a nanequal function be useful? would it be hard to write?
Christopher Barker, Ph.D.
Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
More information about the Numpy-discussion