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

Russell E. Owen rowen at cesmail.net
Tue Jan 24 14:01:06 CST 2006

In article <43D16C31.3060209 at ee.byu.edu>,
 Travis Oliphant <oliphant at ee.byu.edu> wrote:

> Russell E. Owen wrote:
> >We're getting numeric data from a (MySQL) database. We'd like to use 
> >numarray or NumPy on the resulting data, but some values may be None. Is 
> >there a fast, efficient way to replace None with NaN? I'd hate to use a 
> >list comprehension on each data tuple before turning it into an array, 
> >but I haven't thought of anything else.
> >  
> >
> Current numpy SVN allows
> array([1.0,None,2.0],dtype=float)
> array([ 1.        ,         nan,  2.        ])

That's great! Thanks!!

-- Russell

More information about the Numpy-discussion mailing list