I have a dataframe which has daily observation from 2000 to 2020. The dataframe looks like the table below. In "Label" columns there are only three labels "a", "b" and "c".
Date | Label |
---|---|
2000-01-01 | a |
2000-01-01 | b |
2000-01-01 | b |
2000-01-01 | c |
2000-01-01 | a |
... | ... |
2020-12-30 | c |
How can I count the repeat of "a", "b" and "c" separately on annual basis. For example, I'm looking for following table as result for each of "a", "b" and "c":
Year | number of "a" repeats |
---|---|
2000 | 5 |
2001 | 10 |
2002 | 13 |
2003 | 20 |
... | ... |
2020 | 1 |