In [8]:
from vaderSentiment.vaderSentiment import sentiment as vaderSentiment
from Tkinter import *
import pandas as pd
from nltk import tokenize
In [19]:
df = pd.read_csv("awards.csv")
In [ ]:
In [20]:
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']
df.loc[index,'sentiment'] = sumComp / tot
In [21]:
df
Out[21]:
Unnamed: 0
text
ellekingmusic
taylorswift
torikelly
kaceymusgraves
carrieunderwood
samhuntmusic
kanyewest
sofiavergara
...
mattbellamy
nicklachey
pharrell
faithevans
annakendrick
janellemonae
kimkardashian
ciara
annawintour
sentiment
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.427650
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.235567
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.000000
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.395050
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.113333
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.262750
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.233000
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.149050
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.000000
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.000000
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.413400
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.000000
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.277500
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.000000
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.421450
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.189867
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.203800
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.275143
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.525500
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.449950
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.250233
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.034275
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.220067
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.460933
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.333100
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.368633
26
27
.@Adele!!!!!!!!!!!!!!!! #Grammys
0
0
0
0
0
0
0
0
...
0
0
0
0
0
0
0
0
0
0.000000
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.000000
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.000000
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.138150
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
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.000000
80
81
So nice to see #NickLachey and the lovely #Va...
0
0
0
0
0
0
0
0
...
0
1
0
0
0
0
0
0
0
0.267067
81
82
What do YOU think about #Pharrell's blonde ha...
0
0
0
0
0
0
0
0
...
0
0
1
0
0
0
0
0
0
0.000000
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.585900
83
84
#FaithEvans does her best #CruellaDeVille at ...
0
0
0
0
0
0
0
0
...
0
0
0
1
0
0
0
0
0
0.334800
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.392000
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.271150
86
87
#AnnaKendrick kept it basic, pitches! #Grammy...
0
0
0
0
0
0
0
0
...
0
0
0
0
1
0
0
0
0
0.000000
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.000000
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.493900
89
90
#JanelleMonae wears more and MORE at the #Gra...
0
0
0
0
0
0
0
0
...
0
0
0
0
0
1
0
0
0
0.000000
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.246450
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.000000
92
93
#KimKardashian or #ChrissyTeigein: Who did it...
0
0
0
0
0
0
0
0
...
0
0
0
0
0
0
1
0
0
0.266500
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.000000
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.145567
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.090950
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
1
0
-0.093350
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.000000
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.000000
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.222633
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.151500
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.269000
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.000000
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.187200
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.286367
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.000000
106
107
#AnnaWintour approves of #TaylorSwift's #Gram...
0
1
0
0
0
0
0
0
...
0
0
0
0
0
0
0
0
1
0.228700
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.292475
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.179750
109 rows × 65 columns
In [23]:
df.to_csv("fin.csv")
Content source: heatherbshapiro/perezHates
Similar notebooks: