Skip to content

Instantly share code, notes, and snippets.

@amankharwal
Created Feb 19, 2021
Embed
What would you like to do?
l = ["joy", 'fear', "anger", "sadness", "disgust", "shame", "guilt"]
l.sort()
label_freq = {}
for label, _ in data:
label_freq[label] = label_freq.get(label, 0) + 1
# print the labels and their counts in sorted order
for l in sorted(label_freq, key=label_freq.get, reverse=True):
print("{:10}({}) {}".format(convert_label(l, emotions), l, label_freq[l]))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment