Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
import pandas as pd
import time
from nltk.sentiment import SentimentIntensityAnalyzer
t0 = time.time()
top_100 = pd.read_csv('/Users/brit.cava/Desktop/TabPy/top100.csv')
text = top_100['Word']
sid = SentimentIntensityAnalyzer()
word_score_dict = {}
for word in text:
ss = sid.polarity_scores(word)
t1 = time.time()
total = t1-t0
df = pd.DataFrame(list(word_score_dict.iteritems()), columns=['word','score'])
df.to_csv("/Users/brit.cava/Desktop/Scores.csv", index=False, cols=('word','score'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment