I have a pandas data frame with numbers looking like this:
a b c
0 2 3 1
1 1 2 2
2 1 3 2
3 2 4 1
4 2 4 1
5 1 1 3
I want to count each unique value in column "b" and add the count for each value to my data frame in a new column accordingly:
a b c count_b
0 2 3 1 2
1 1 2 2 1
2 1 3 2 2
3 2 4 1 2
4 2 4 1 2
5 1 1 3 1
How can I do this?