Skip to content

Instantly share code, notes, and snippets.

@talwai
Created January 14, 2015 02:06
Show Gist options
  • Save talwai/6ebc9a75fdfd97a81843 to your computer and use it in GitHub Desktop.
Save talwai/6ebc9a75fdfd97a81843 to your computer and use it in GitHub Desktop.
def ten_most_prolific(rows):
# Who are the top 10 most prolific artists in the data
# along with the number of their songs that appear in the data?
artists = [row['ARTIST CLEAN'] for row in rows]
c = Counter(artists)
sorted_c = sorted(c.items(), key=operator.itemgetter(1), reverse=True)
return sorted_c[:10]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment