[Numpy-discussion] None as missing value

Sven Schreiber svetosch at gmx.net
Mon Jul 3 05:53:43 EDT 2006


Travis Oliphant schrieb:


> 
> You can use a masked array specifically, or use nan's for missing values 
> and just tell Python you want a floating-point array (because it finds 
> the None object it's guessing incorrectly you want an "object" array.
> 
> asarray(x, dtype=float)
> 
> array([[ 1.        ,         nan],
>        [ 2.        ,  3.        ]])
>

Is there anything else besides None which is recognized/converted to
numpy.nan?
Put differently, where can I find documentation about basic nan
definition and handling in numpy? (I have the numpy book which covers
isnan etc., when you have the nans already set up.)

I was also a bit surprised at the following behavior:

>>> a = numpy.asarray([1,1])
>>> a
array([1, 1])
>>> a[0]=numpy.nan
>>> a
array([0, 1])

Is this a bug or intended?

Thanks,
Sven




More information about the NumPy-Discussion mailing list