I want to count the frequency of a value that are same in 2 column, also adding a column at the end that display the counting number & delete the first cloumn.
The dataframe I have
| Column A | Column B | Column C |
| -------- | -------- | -------- |
| Column A | Cat | Fish |
| Column A | Cat | Apple |
| Column A | Cat | Apple |
| Column A | Dog | Lemon |
| Column A | Dog | Fish |
| Column A | Dog | Fish |
The expected outcome is like
| Column A | Column B | Column C |
| -------- | -------- | -------- |
| Cat | Fish | 1 |
| Cat | Apple | 2 |
| Dog | Lemon | 1 |
| Dog | Fish | 2 |
I have tried the
df['Column B'].value_counts()
But I don't know to handle 2 cloumn at the same time.