[SciPy-user] casting ndarray object to double

Christopher Clarke cclarke@chrisdev....
Wed Oct 31 08:50:27 CDT 2007


Hi
What's the most efficient way of casting an object array to a double  
ndarray?
other than
numpy.array(obj_arr.tolist(),dtype='d')

The  original data is a list of tuples form a SQL query which could  
potentially contain None
Indeed a masked array would be more ideal  where None is replaced  by  
the mask
I'm currently using list comprehension to replace the None in the  
original data with the mask
  But i wish to eliminate this step if possible
Regards
Chris



More information about the SciPy-user mailing list