I have a data frame with the column countries like:
CHINA
RUSSIA
CHINA
PAKISTAN/CHINA/RUSSIA
I want to count the occurrence of each country:
I did df.Countries=df.Countries.str.split('/')
to get rid of the /
and df.Countries.value_counts()
this was the output:
[CHINA] 1
[RUSSIA] 1
[PAKISTAN, CHINA, RUSSIA] 1
How do I fix the counts for the multiple countries? Thank you! Desired Output
CHINA 3
RUSSIA 2
PAKISTAN 1
So far it is not counting correctly.