Premium problem48. Sum per Second Level via unstack

Medium Locked

Without passing a level argument directly to a sum-like reduction, compute the sum of s for each label of the second level of its MultiIndex. Return a Series indexed by the second-level labels.

Input

A  0     0
   1     1
   2     2
   3     3
   4     4
        ..
C  5    25
   6    26
   7    27
   8    28
   9    29
Length: 30, dtype: int64

Output

0    30
1    33
2    36
3    39
4    42
5    45
6    48
7    51
8    54
9    57
dtype: int64

Premium problem

This one's part of Premium. Unlock the full Pandas track plus every other premium problem on the site.

Implement solve(...)