How to check for nan in an array?

Yves yves.frederix at gmail.com
Mon Oct 30 05:53:45 EST 2006


Forget it. N.isnan() does the job.

YVES

On Mon, Oct 30, 2006 at 11:47:57AM +0100, Yves wrote:
> Hi, 
> 
> Is there a way of checking for nan's in an array, as comparing to N.nan
> doesn't seem to work.
> 
> 	In [1]: import numpy as N
> 
> 	In [2]: a = N.asarray(0.)/0
> 	Warning: invalid value encountered in divide
> 
> 	In [3]: a
> 	Out[3]: nan
> 
> 	In [4]: a==N.nan
> 	Out[4]: False
> 
> 	In [5]: b = a.copy()
> 
> 	In [6]: a==b
> 	Out[6]: False
> 
> 	In [7]: b
> 	Out[7]: nan
> 
> 	In [8]: N.__version__
> 	Out[8]: '1.0.dev3390'
> 
> 
> Many thanks,
> YVES
> 
> 
> -------------------------------------------------------------------------
> Using Tomcat but need to do more? Need to support web services, security?
> Get stuff done quickly with pre-integrated technology to make your job easier
> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> _______________________________________________
> Numpy-discussion mailing list
> Numpy-discussion at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/numpy-discussion

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642




More information about the NumPy-Discussion mailing list