Announcements

Help Wizard

Step 1

NEXT STEP

Integrate Genres to My Extended Streaming History on Jupyter Notebook

Integrate Genres to My Extended Streaming History on Jupyter Notebook

Hello,
I'm currently analyzing my extended streaming history and the data doesn't have a genre column. I'm using Python on a Jupyter Notebook/Google Colab for the analysis and the code read the JSON file as a table, as shown by the screenshot below. How can I find out the genre from the song title and/or artist without having to manually add them one by one? Of course since there are tens of thousands of data, it's impossible for me to do a manual way to add it. Hope there's any certain way to match it and add it as a new column.

Thank you.

 

Screenshot_2053.png

Reply
2 Replies

Spotify only provides artist genres. so get the artist uris over get tracks and then get artists -> ['genres']

And you can store the artists with their genres in s file after every request, so you don't have to call the API for genres of artists you already have.

Suggested posts