This is my first post on this site, so my apologies for any mistakes I make in this post.
I am working on a Twitter Sentiment analysis for a company. I have a csv filled with tweets (just 1 column) and I want to find out if they are talking positively about that company or negatively. I found a package that can find the polarity & subjectivity from a sentence. For example, this is my python script were I want to find the results from:
from pattern.nl import sentiment
print sentiment('I love this company!')
and the result:
(0.75, 0.90)
At this point, everything works well, but I need to do this for 6000+ tweets, so I thought about reading the csv into the script and do it for each row.
import csv
from pattern.nl import sentiment
import sys
f = open('C:\Users\Admin\Desktop\TweetsFromNodeXLOnlyTweets.csv')
try:
reader = csv.reader(f)
for row in reader:
text = row
print sentiment(text)
finally:
f.close()
When I run this, I just get (0.00, 0.00) for all tweets. It seems like the script isn’t able to read it, but when I just print text, I get all tweets as I should. And when I write print sentiment(text), I do get the results I want, but only for that one tweet. How could I fix this? I am pretty new to Python (started yesterday), but no tutorial or other post on this site could help me with thi!s.