How to check for nan in an array?

Yves yves.frederix at gmail.com
Mon Oct 30 05:47:57 EST 2006


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




More information about the NumPy-Discussion mailing list