I have a pandas dataframe/csv of the form
date Country Type Val
2013-01-01 USA x 23
2013-01-01 USA y 13
2013-01-01 MX x 11
2013-01-01 MX y 14
2013-01-02 USA x 20
2013-01-02 USA y 19
2013-01-02 MX x 14
2013-01-02 MX y 16
I want to convert this to a form
date Country x y
2013-01-01 USA 23 13
2013-01-01 MX 11 14
2013-01-02 USA 20 19
2013-01-02 MX 14 16
In general I am looking for a way to transform a table using unique values of a single column.
I have looked at pivot
and groupby
but didn't get the exact form.
HINT: possibly this is solvable by pivot
but I haven't been able to get the form