array from list of lists

Erin Sheldon erin.sheldon at
Sun Nov 12 21:17:17 CST 2006

On 11/12/06, Tim Hochberg <tim.hochberg at> wrote:
> I haven't been following this too closely, but if you need to transpose
> your data without converting all to one type, I can think of a couple of
> different approaches:
>     1.  zip(*yourlist)
>     2. numpy.transpose(numpy.array(yourlist, dtype=object)
> I haven't tested them though (particularly the second one), so caveat
> emptor, etc, etc.

Its not that I want to transpose data.

I'm trying to convert the output of a pgdb postgres query into
an array with fields and types corresponding to the columns
I have selected.  The problem is pgdb does not return a list
of tuples as it should according to DB 2.0, but instead
a list of lists.   So numpy.array(lol, dtype=) fails, and so will your
solution #2.   I don't want to copy the data more than once
obviously, so I'm looking for a way to call array() with a lists
of lists.


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

More information about the Numpy-discussion mailing list