I have a data frame similar to the following
+----------------+-------+
| class | year |
+----------------+-------+
| ['A', 'B'] | 2001 |
| ['A'] | 2002 |
| ['B'] | 2001 |
| ['A', 'B', 'C']| 2003 |
| ['B', 'C'] | 2001 |
| ['C'] | 2003 |
+----------------+-------+
I want to create a data frame using this so that the resulting table shows the count of each category in class per yer.
+-----+----+----+----+
|year | A | B | C |
+-----+----+----+----+
|2001 | 1 | 3 | 1 |
|2002 | 1 | 0 | 0 |
|2003 | 1 | 1 | 2 |
+-----+----+----+----+
What's the easiest way to do this?