I have a csv like below. 

```
a,b,c,d
A,A1,10,B1
A,A1,20,B1
A,A1,30,B1
A,A1,10,B4
A,A1,20,B4
A,A1,10,B5
A,A1,10,B6
B,A2,10,B7
B,A2,20,B1
B,A2,100,B1

```

I want to take the last line of each group and sum the column `c` for each 'a'.

I am able to take last using`.last()` but stuck at doing the sum per 'a' where a is the first `groupby` criteria

```
>>> tmp.groupby(['a','b','d']).nth(-1)
           c
    a b  d      
    A A1 B1   30
         B4   20
         B5   10
         B6   10
    B A2 B1  100
         B7   10
    >>> tmp.groupby(['a','b','d']).nth(-1)['c'].sum()
    180

```

Instead of 180 I need 70, (sum of group A) and 110 (sum of group B)

I think grouping is lost when using last() or nth(-1)