I have a dataframe which needs to be consolidated for same ids and split other columns to different columns as such. I have presented the example input dataframe and required output dataframe.
Input dataframe example
data = {'id':[1, 1, 1, 2, 2, 2],
'status':[3, 3, 3, 4, 4, 4],
'amount':[30, 40, 50, 60, 70, 80],
'paid':[100, 200, 300, 400, 500, 600]}
dataframe = pd.DataFrame(data)
id status amount paid
0 1 3 30 100
1 1 3 40 200
2 1 3 50 300
3 2 4 60 400
4 2 4 70 500
5 2 4 80 600
Required output dataframe
id status amount_1 amount_2 amount_3 paid_1 paid_2 paid_3
0 1 3 30 40 50 100 200 300
1 2 4 60 70 80 300 400 600