Skip to content

Instantly share code, notes, and snippets.

@amankharwal
Created April 9, 2021 09:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amankharwal/8986e3864bed5e885a19316076869666 to your computer and use it in GitHub Desktop.
Save amankharwal/8986e3864bed5e885a19316076869666 to your computer and use it in GitHub Desktop.
total_emojis_list = list(set([a for b in messages_df.emoji for a in b]))
total_emojis = len(total_emojis_list)
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)
for i in emoji_dict:
print(i)
emoji_df = pd.DataFrame(emoji_dict, columns=['emoji', 'count'])
import plotly.express as px
fig = px.pie(emoji_df, values='count', names='emoji')
fig.update_traces(textposition='inside', textinfo='percent+label')
fig.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment