'How to count the amount of times a certain word appears in my python output? (Multiple Lines/Long List)
so I am doing some sentiment analysis on a bunch of reviews (100,000 reviews which I data cleaned down to 9,000). I successfully analyzed each review into Positive and Negative. Now when I print my results, it prints each of the reviews and says "Positive" or "Negative". Here is a simplified results of my output https://i.imgur.com/y0iALSg.jpg
Now I want to count the amount of times "Positive" appears and amount of times "Negative" appears. I tried a bunch of different ways but the furthest I've gotten is to count only the first line of my output.
Here's one of the ways I've tried:
x = sentimentprediction.count('Positive')
print(x)
Any thoughts on how to do this?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
