Skip to content

Instantly share code, notes, and snippets.

@amankharwal
Created January 16, 2021 06:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save amankharwal/cb3e539f94a46da658532ff324fe50f9 to your computer and use it in GitHub Desktop.
Save amankharwal/cb3e539f94a46da658532ff324fe50f9 to your computer and use it in GitHub Desktop.
dfx=dff[['release_year','description']]
dfx=dfx.rename(columns={'release_year':'Release Year'})
for index,row in dfx.iterrows():
z=row['description']
testimonial=TextBlob(z)
p=testimonial.sentiment.polarity
if p==0:
sent='Neutral'
elif p>0:
sent='Positive'
else:
sent='Negative'
dfx.loc[[index,2],'Sentiment']=sent
dfx=dfx.groupby(['Release Year','Sentiment']).size().reset_index(name='Total Content')
dfx=dfx[dfx['Release Year']>=2010]
fig4 = px.bar(dfx, x="Release Year", y="Total Content", color="Sentiment", title="Sentiment of content on Netflix")
fig4.show()
@KareemAyman99
Copy link

hello, can you please explain to me dfx.loc[[index,2],'Sentiment']=sent what does the int 2 here means? what does it refer to?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment