I am trying to re figure a DataFrame with the following components:
Name Date X Y
1 James 01/01/10 A 10
2 James 01/01/10 B 20
3 Sarah 02/01/10 A 30
4 Sarah 02/01/10 B 40
5 Sarah 03/01/10 A 50
Column X needs to be transposed into new columns with Name and Date grouped together. I have tried using pd.pivot and pd.pivot_table to get the resulting table below but have had no luck ie. pd.pivot_table(df, index=['Name','Date'], columns = 'X').reset_index()
Name Date A B
1 James 01/01/10 10 20
3 Sarah 02/01/10 30 40
5 Sarah 03/01/10 50