Sample of data, actual data has many years. The type "Lien" or "Lien Endorsement" can only appear once per year. Other types can repeat within a year.

tax\_allyears = 

```
tax_year    type                amount  
2013        Lien Interest       4
2014        Lien Interest       10
2014        Lien                100
2014        Lien Interest       15
2013        Lien Endorsement    200

```

This line almost works, it sums the "Lien Interest" values by year.

```
by_year_interest = tax_allyears_1[tax_allyears_1['type'] == 'Lien Interest'].groupby(by=['tax_year'])['amount'].sum()

```

What I want is to distinguish between years that have "Lien" vs "Lien Interest"

by\_year\_Lien\_interest = some function

```
tax_year    amount
2014        25

```

by\_year\_Lien\_Endorsement\_interest = some function

```
tax_year    amount
2013        4

```