[SciPy-user] casting ndarray object to double

Matthieu Brucher matthieu.brucher@gmail....
Wed Oct 31 08:53:24 CDT 2007


Hi,

Did you try numpy.asfarray(obj_arr) ?

Matthieu

2007/10/31, Christopher Clarke <cclarke@chrisdev.com>:
>
> 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
>
> _______________________________________________
> SciPy-user mailing list
> SciPy-user@scipy.org
> http://projects.scipy.org/mailman/listinfo/scipy-user
>



-- 
French PhD student
Website : http://miles.developpez.com/
Blogs : http://matt.eifelle.com and http://blog.developpez.com/?blog=92
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/scipy-user/attachments/20071031/0656c325/attachment.html 


More information about the SciPy-user mailing list