In [2]:
from vaderSentiment.vaderSentiment import sentiment as vaderSentiment 
from Tkinter import *
import pandas as pd

In [6]:
df = pd.read_csv("awards.csv")

In [5]:
awards


Out[5]:
Unnamed: 0 text ellekingmusic taylorswift torikelly kaceymusgraves carrieunderwood samhuntmusic kanyewest sofiavergara ... davegrohl mattbellamy nicklachey pharrell faithevans annakendrick janellemonae kimkardashian ciara annawintour
0 1 #Zendaya is working a rat tail on the #Grammys... 0 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0 0 0
1 2 So happy for my bud @ElleKingMusic!!! Look at ... 1 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0 0 0
2 3 Abs!!! @taylorswift13 is serving it tonight!!!... 0 1 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0 0 0
3 4 #SelenaGomez is dressed like she's ready to g... 0 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0 0 0
4 5 Note to E! - @KaceyMusgraves is not @ToriKell... 0 0 1 1 0 0 0 0 ... 0 0 0 0 0 0 0 0 0 0
5 6 The wickedly stylish @ToriKelly glimmers in g... 0 0 1 0 0 0 0 0 ... 0 0 0 0 0 0 0 0 0 0
6 7 Do YOU like #TaylorSwift's new hair she debut... 0 1 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0 0 0
7 8 .@KaceyMusgraves picks the Little Mermaid col... 0 0 0 1 0 0 0 0 ... 0 0 0 0 0 0 0 0 0 0
8 9 .@carrieunderwood is the ultimate California ... 0 0 0 0 1 0 0 0 ... 0 0 0 0 0 0 0 0 0 0
9 10 Is anybody else still thinking about @SamHuntM... 0 0 0 0 0 1 0 0 ... 0 0 0 0 0 0 0 0 0 0
10 11 That�s my best friend! #GRAMMYs @selenagomez @... 0 1 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0 0 0
11 12 .@KanyeWest watching the #Grammys from his hot... 0 0 0 0 0 0 1 0 ... 0 0 0 0 0 0 0 0 0 0
12 13 #Adele explains the awful sound issue at the #... 0 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0 0 0
13 14 .@SofiaVergara is the ultimate video girl!!!!!... 0 0 0 0 0 0 0 1 ... 0 0 0 0 0 0 0 0 0 0
14 15 This is how I feel about @taylorswift13 winnin... 0 1 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0 0 0
15 16 Bravo, @LadyGaGa! Bowie would be proud!! #Grammys 0 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0 0 0
16 17 Now this is @LadyGaGa in her element. Wonderfu... 0 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0 0 0
17 18 Yes. Yes. YES!!! @Meghan_Trainor has been work... 0 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0 0 0
18 19 The @Adele sound issues have ruined the #Gramm... 0 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0 0 0
19 20 Think what you will about @justinbieber, you c... 0 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0 0 0
20 21 They're not even gonna address the Adele sound... 0 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0 0 0
21 22 .@Adele better come back and do that over agai... 0 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0 0 0
22 23 Stop! Someone stop @Adele and have her start o... 0 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0 0 0
23 24 Is that awful guitar sound on purpose???? I'm ... 0 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0 0 0
24 25 WHAT THE FUCK IS UP WITH THE SOUND DURING QUEE... 0 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0 0 0
25 26 What the fuck??? That guitar is sounding wack ... 0 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0 0 0
26 27 .@Adele!!!!!!!!!!!!!!!! #Grammys 0 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0 0 0
27 28 I am standing up in my apartment for @kendrick... 0 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0 0 0
28 29 This @kendricklamar performance has me in goos... 0 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0 0 0
29 30 Damn!!!! @kendricklamar is giving me more thea... 0 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0 0 0
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
79 80 .@Miguel always looks so fly!!!!!! #Grammys h... 0 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0 0 0
80 81 So nice to see #NickLachey and the lovely #Va... 0 0 0 0 0 0 0 0 ... 0 0 1 0 0 0 0 0 0 0
81 82 What do YOU think about #Pharrell's blonde ha... 0 0 0 0 0 0 0 0 ... 0 0 0 1 0 0 0 0 0 0
82 83 Relive @ddlovato's vocals and the amazing @Jo... 0 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0 0 0
83 84 #FaithEvans does her best #CruellaDeVille at ... 0 0 0 0 0 0 0 0 ... 0 0 0 0 1 0 0 0 0 0
84 85 Easily one of the best of the night! Watch @A... 0 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0 0 0
85 86 Country's had a big night at the #Grammys! Wa... 0 0 0 0 1 1 0 0 ... 0 0 0 0 0 0 0 0 0 0
86 87 #AnnaKendrick kept it basic, pitches! #Grammy... 0 0 0 0 0 0 0 0 ... 0 0 0 0 0 1 0 0 0 0
87 88 .@MichaelJackson would approve of @theweeknd'... 0 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0 0 0
88 89 Watch @taylorswift13's confident and confetti... 0 1 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0 0 0
89 90 #JanelleMonae wears more and MORE at the #Gra... 0 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 1 0 0 0
90 91 .@AngelAlessandra looks like.. well, the supe... 0 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0 0 0
91 92 .@Meghan_Trainor hits a fashion HOMERUN at th... 0 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0 0 0
92 93 #KimKardashian or #ChrissyTeigein: Who did it... 0 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 1 0 0
93 94 .@JustinBieber and his baby moustache rock th... 0 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0 0 0
94 95 Sorry, #ArianaGrande. No! https://t.co/dSquIU... 0 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0 0 0
95 96 .@LadyGaGa in Bowie drag is a... HIT! Total w... 0 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0 0 0
96 97 If #Ciara isn't careful, she may have a pussy... 0 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0 1 0
97 98 It's official. @chrissyteigen at the #Grammys... 0 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0 0 0
98 99 .@justinbieber and @JKCorden do a carpool kar... 0 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0 0 0
99 100 .@SerayahLove is channeling Good Girl Gone Ba... 0 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0 0 0
100 101 .@littlebigtown make a statement at the #Gram... 0 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0 0 0
101 102 .@ddlovato rocks some fierce extensions and g... 0 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0 0 0
102 103 .@theweeknd and @bellahadid are the hottest c... 0 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0 0 0
103 104 .@kaleycuoco just outshone most of the musici... 0 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0 0 0
104 105 .@elliegoulding is soft and pretty in pink an... 0 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0 0 0
105 106 .@ADELE!!!!!!!!!!!!! https://t.co/D6FhbIhLPf ... 0 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0 0 0
106 107 #AnnaWintour approves of #TaylorSwift's #Gram... 0 1 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0 0 1
107 108 .@KendrickLamar was THE BEST #Grammys performe... 0 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0 0 0
108 109 I can�t stop thinking about #Adele's problem-p... 0 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0 0 0

109 rows × 64 columns


In [ ]:
for index, row in df.iterrows():
    print index
    sentences = tokenize.sent_tokenize(row["text"])
    sumComp = 0
    sumPos = 0
    sumNeg = 0
    tot = len(sentences)
    pos = 0
    neg = 0
    neu = 0
    compPos = 0
    compNeg = 0
    compNeutral = 0
    for sentence in sentences: 
        vs = vaderSentiment(sentence)
        sumComp += vs['compound']
        sumPos += vs['pos']
        sumNeg += vs['neg']
        if vs['pos'] > .25:
            pos +=1
        if vs['neg'] > .25:
            neg += 1
        if vs['neu'] > .5:
            neu +=1
        if vs['compound'] > .25:
            compPos +=1
        if vs['compound'] < -.25:
            compNeg +=1
        if -.25<= vs['compound'] <.25:
            compNeutral +=1
    df.loc[index,'compound'] = sumComp / tot
    df.loc[index,'compNeutral'] = compNeutral
    df.loc[index, 'comppos'] = compPos
    df.loc[index, 'compneg'] = compNeg
    df.loc[index,'percentPos'] = sumPos / tot
    df.loc[index,'Total'] = tot