I have a DataFrame such as this:
Index Label
0 ABCD
1 EFGH
2 ABCD
3 ABCD
4 EFGH
5 ABCD
6 IJKL
7 IJKL
8 ABCD
9 EFGH
So, "ABCD" occurs 5 times, "EFGH" 3 times and "IJKL" twice. I want to count the occurence of each Label and replace the individual labels with their count, to get the following:
Index Label
0 5
1 3
2 5
3 5
4 3
5 5
6 2
7 2
8 5
9 3
What is the nicest way to do this? Thank you!