Id 1 2 3 4
z1 3 0 2 2
z1 1 4 4 3
z2 8 1 7 9
z2 0 0 2 3
z2 5 6 7 9
z3 0 5 6 2
z3 4 4 8 2
Here is my data, I want to group every column into lists by Id, result should be this
Id 1 2 3 4
z1 [3,1] [0,4] [2,4] [2,3]
z2 [8,0,5][1,0,6][7,2,7][9,3,9]
z3 [0,4] [5,4] [6,8] [2,2]
So here is the thing I could do every column separately but I've done that and now I need to optimize this, is there any way for this to be done once for every column?? If not, maybe there is a way that works faster than pandas.groupby??