Created
August 5, 2020 11:32
-
-
Save kurasaiteja/e5acefc218b28f524cd3881d356ebee0 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
def visualize_emoji(data): | |
total_emojis_list = list([a for b in messages_df.emoji for a in b]) | |
emoji_dict = dict(Counter(total_emojis_list)) | |
emoji_dict = sorted(emoji_dict.items(), key=lambda x: x[1], reverse=True) | |
emoji_df = pd.DataFrame(emoji_dict, columns=['emoji', 'count']) | |
fig = px.pie(emoji_df, values='count', names='emoji') | |
fig.update_traces(textposition='inside', textinfo='percent+label') | |
fig.update_layout( | |
margin=dict( | |
l=5, | |
r=5, | |
) | |
) | |
fig.update(layout_showlegend=False) | |
return fig | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment