Question: I have a data frame with the column countries like: CHINA RUSSIA CHINA PAKISTAN/CHINA/RUSSIA I want to split the ones with and count the occurrence

 I have a data frame with the column countries like: CHINA

I have a data frame with the column countries like: CHINA RUSSIA CHINA PAKISTAN/CHINA/RUSSIA I want to split the ones with and 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 Outpu CHINA 3 RUSSIA 2 PAKISTAN 1 So far it is not counting correctly

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!