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

Russell E. Owen rowen at cesmail.net
Wed Jan 18 16:02:09 CST 2006


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.

numarray.array and numarray.where are both intolerant of None in the 
input data.

-- Russell





More information about the Numpy-discussion mailing list