This is how my data looks:

I want to see how many times a word appears in every posts cell.
e.g. In the 3rd row, the word personality occurred 2 times.
This is my code:

CodePudding user response:
It's simple. Just use .str.count:
df['personality_count'] = df['posts'].str.count('personality')
