[SciPy-user] casting ndarray object to double

Matthieu Brucher matthieu.brucher at gmail.com
Wed Oct 31 09:53:24 EDT 2007


Hi,

Did you try numpy.asfarray(obj_arr) ?

Matthieu

2007/10/31, Christopher Clarke <cclarke at 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 at 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://mail.scipy.org/pipermail/scipy-user/attachments/20071031/0656c325/attachment.html>


More information about the SciPy-User mailing list