-
-
Save amankharwal/3324ea451effec59f11d615cd932a7d9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
count_1 = df_subset_trump.groupby('Expression Label').count() | |
print(count_1) | |
negative_per1 = (count_1['Sentiment Polarity'][0]/1000)*10 | |
positive_per1 = (count_1['Sentiment Polarity'][1]/1000)*100 | |
count_2 = df_subset_biden.groupby('Expression Label').count() | |
print(count_2) | |
negative_per2 = (count_2['Sentiment Polarity'][0]/1000)*100 | |
positive_per2 = (count_2['Sentiment Polarity'][1]/1000)*100 | |
Politicians = ['Joe Biden', 'Donald Trump'] | |
lis_pos = [positive_per1, positive_per2] | |
lis_neg = [negative_per1, negative_per2] | |
fig = go.Figure(data=[ | |
go.Bar(name='Positive', x=Politicians, y=lis_pos), | |
go.Bar(name='Negative', x=Politicians, y=lis_neg) | |
]) | |
# Change the bar mode | |
fig.update_layout(barmode='group') | |
fig.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment