array from list of lists

Pierre GM pgmdevlist at gmail.com
Sun Nov 12 22:06:33 CST 2006


On Sunday 12 November 2006 20:10, Erin Sheldon wrote:
> Actually, there is a problem with that approach.  It first converts
> the entire array to a single type, by default a floating type.  

As A.M. Archibald suggested, you can use list comprehension:
N.array([(a,b,c,d,) for (a,b,c,d) in yourlist], dtype=yourdesc)

or

N.fromiter(((a,b,c,d) for (a,b,c,d,) in yourlist), dtype=yourdesc)

Would you mind trying that, and let us know which one works best ? That could 
be put on the wiki somewhere...


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642




More information about the Numpy-discussion mailing list