From: Erin S. <eri...@gm...> - 2006-11-13 03:17:23
|
On 11/12/06, Tim Hochberg <tim...@ie...> 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. Erin |