Here's some data from another question:
date       type       value
1/1/2016   a          1
1/1/2016   b          2
1/1/2016   a          1
1/1/2016   b          4
1/2/2016   a          1
1/2/2016   b          1
Run this line of code:
x = df.groupby(['date', 'type']).value.agg(['sum', 'max']).unstack()
x should look like this:
         sum    max   
type       a  b   a  b
date                  
1/1/2016   2  6   1  4
1/2/2016   1  1   1  1
I want to combine the columns on the upper and lower level to get this:
           sum_a  sum_b   max_a  max_b
date                  
1/1/2016   2       6        1       4
1/2/2016   1       1        1       1
Is there an easy way to do this?
 
     
    