In the data set I am trying to make a bar graph on top 10 artists that have the highest number of songs in top 500 songs of all time. I have the result, however I am unable to visualize it. I need to make a bar graph of the output that I am getting from this code. Can someone tell what code should I add to make a bar graph of the output. I imported pandas, seaborn and matplot, just need help with the code.
counts = dict()
for artists in my_data['artist']:
counts[artists] = counts.get(artists, 0) + 1
def keyfunction(k):
return counts[k]
plt.figure(figsize = (10, 30))
plt.title("Greatest Artists of All Time")
data = dict()
for key in sorted(counts, key=keyfunction, reverse=True)[:10]:
print(key, counts[key])
Need to make a bar plot of the following output
Elton John 18
The Beatles 16
Elvis Presley 12
The Jimi Hendrix Experience 12
The Four Tops 10
Muddy Waters 8
Sam Cooke 8
The Clash 8
U2 8
The Isley Brothers 8