osdir.com


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

using zip for transpose


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