using zip for transpose

Robin Becker robin at
Thu Feb 21 04:52:18 EST 2019

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 list just copied into the zip *args; I suppose calling zip(A[0],A[1],......A[len(A)-1]) cannot be how this is done.
Robin Becker

More information about the Python-list mailing list