Re: using zip for transpose

2019-02-21 Thread Robin Becker
On 21/02/2019 13:49, Peter Otten wrote: Robin Becker wrote: ... Isn't df.values a numpy array? Then try the more direct and likely more efficient df.values.tolist() or, if you ever want to transpose df.values.T.tolist() The first seems to achieve what your sample code does. (In

Re: using zip for transpose

2019-02-21 Thread Peter Otten
Robin Becker wrote: > In conversion of pandas dataframe to reportlab table I suggested using > this expression > > [list(x) for x in map(list,zip(*[df[i].values for i in df]))] > > which effectively transposes the dataframe. However, it's not clear that > this works for a large number of rows.

using zip for transpose

2019-02-21 Thread Robin Becker
In conversion of pandas dataframe to reportlab table I suggested using this expression [list(x) for x in map(list,zip(*[df[i].values for i in df]))] which effectively transposes the dataframe. However, it's not clear that this works for a large number of rows. Is the argument *A for A a large