Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

I want to see how many times a word appears in every cell (CSV)

This is how my data looks:

This is how my data looks

I want to see how many times a word appears in every posts cell.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

e.g. In the 3rd row, the word personality occurred 2 times.

This is my code:

This is all I have

>Solution :

It’s simple. Just use .str.count:

df['personality_count'] = df['posts'].str.count('personality')
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading