Last active
August 4, 2018 12:22
-
-
Save patricoferris/528ee5b50185873e1183ee7c20ccb83b to your computer and use it in GitHub Desktop.
This file contains 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
genres = {} | |
genre_lookup = {} | |
scores = {} | |
cursor.execute('select distinct genre from genres') | |
for row in cursor: | |
genre_lookup[len(genre_lookup)] = row[0] | |
genres[row[0]] = [] | |
for i in range(11): | |
scores[i] = [] | |
#We start adding the different artists into our dictionaries | |
for artist in artist_dict: | |
for genre in artist_dict[artist].genres: | |
#We don't want to add them more than once - although maybe this could be a weighting | |
#as in how 'rocky' are the band? | |
if artist not in genres[genre]: | |
genres[genre].append(artist_lookup[artist]) | |
mean_score = np.mean(artist_dict[artist].scores) | |
scores[round(mean_score)].append(artist_lookup[artist]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment