[Numpy-discussion] How do I test if an array contains NaN ?

Robert Kern robert.kern at gmail.com
Thu Jan 4 18:19:32 EST 2007


Sebastian Haase wrote:
> Hi!
> 
> Simple question:
> How do I test if an array contains NaN ?
> Or others like inf ...?

In [1633]: isinf?
Type:           ufunc
Base Class:     <type 'numpy.ufunc'>
Namespace:      Interactive
Docstring:
    y = isinf(x) returns True where x is +inf or -inf


In [1634]: isnan?
Type:           ufunc
Base Class:     <type 'numpy.ufunc'>
Namespace:      Interactive
Docstring:
    y = isnan(x) returns True where x is Not-A-Number


In [1635]: isfinite?
Type:           ufunc
Base Class:     <type 'numpy.ufunc'>
Namespace:      Interactive
Docstring:
    y = isfinite(x) returns True where x is finite


-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
 that is made terrible by our own mad attempt to interpret it as though it had
 an underlying truth."
  -- Umberto Eco



More information about the NumPy-Discussion mailing list