I have df:
df = pd.DataFrame({'CaseNo':[1,1,2,2,2,2],
'Test1':['180','189','328','328','266','256'],
'Test2':['20','21','33','30','28','15'],
'Test3':['55','55','58','64','68','58'],
'Age':['65','65','45','45','45','45']})
In Python, after pivoting with this code:
df = (pd.pivot_table(s, index=["CaseNo","Age"],
aggfunc=["last", list]).reset_index())
I get this:
The columns look weird here. How can I format the cols to look like this: