[Numpy-discussion] Re: Efficient way to handle None->nan?

Russell E. Owen rowen at cesmail.net
Fri Jan 20 14:44:05 EST 2006


In article 
<d38f5330601181610m32d70b2blee1ef9501b67c63b at mail.gmail.com>,
 Sasha <ndarray at mac.com> wrote:

> >>> from numpy.core.ma import masked values
> >>> from numpy import nan
> >>> masked values([1.0,None,2.0],None).filled(nan).astype(float)
> array([ 1.        ,         nan,  2.        ])

Neat! Any idea if that's likely to keep working in future versions? It 
doesn't work in numarray.ma.masked_values and in general it seems like a 
lot of numpy and numarray raise exception when they get a list that 
contains None.

-- Russell





More information about the NumPy-Discussion mailing list