DIY Spotify Wrapped in Python & Tableau
import pandas as pd
import numpy as np
df = pd.read_json('MyData\StreamingHistory1.json')
import spotipy
from spotipy.oauth2 import SpotifyClientCredentials

client_id = 'client-id'
client_secret = 'client-secret'
client_credentials_manager = SpotifyClientCredentials(client_id=client_id, client_secret=client_secret)
sp = spotipy.Spotify(client_credentials_manager=client_credentials_manager)
def get_artist_genre(name):
result =
if not result["tracks"]["items"]:
return []
track = result['tracks']['items'][0]
artist = sp.artist(track["artists"][0]["external_urls"]["spotify"])
return artist["genres"]
gen_list = []
for name in df['artistName']:
df_genre = pd.Series(gen_list)
df_genre = pd.DataFrame(df_genre,columns=["genre"])
df_genre_expanded = df_genre.explode("genre")
We Will Rock You is classified as nu metal which doesn’t seem right, but that’s because Spotify only has artist genres, not song genres. Not that I know anything about nu metal to begin with.
  • Genres: Touhou is this period’s mainstay! I went crazy after finding out the official game OST + my favourite doujin circles started uploading their albums on the platform. I totaled 1269 streams, making it the largest genre bubble. (Interestingly, my Spotify Wrapped didn’t really pick up on Touhou. Maybe because they gave equal weight to the first half of 2021?)
  • Top Songs/Artists: The data confirms my Wrapped report that I’m a huge fan of motivational, game battle and high tempo music in general. I mean, when you’re running on intrinsic motivation 80% of the time, you need that kind of music to keep on upping the ante.
  • Listens by Week: I was averaging 263 songs and 400 minutes of music a week, both of which were gradually rising as I decided to buckle down and prepare for projects and finals closer to the end of the term. Also, 1.5mins per song on average means that I skip through songs pretty often, lol…
  • Listens by Time of Day: Somehow, I successfully protected the sanctity of my sleep schedule, with very few streams between 11PM and 7AM. Given that I am a college student, I think this is worth mentioning.
  • I listened to the “Dream SMP” genre 219 times. I have no explanation for this and frankly, I’m afraid of myself now.
  • Some genres I didn’t know existed: “afrofuturismo brasiliero”, “cybergrind”, “manguebeat”.
  • Pink Guy ranks higher than the Financial Times News Briefing.




20 / Singapore

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Network Services 2 WriteUp — TryHackMe

Cron & logrotate: How To Use Cron To Automate Tasks

Google Sheets

CS371p Spring 2022: Lisa Alexander

How to decode a partially visible or damaged QR Code: a CTF writeup for STACK the Flags 2020

Performance comparison of different operations on Linked List under Serial and Multi-threaded…

NFTS are not just JPEGs!

Ruby Algorithm Questions For Beginners

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Jolie Fong

Jolie Fong

20 / Singapore

More from Medium

Hypothesis Test Analysis on Telco Customer Dataset Using Weka and Excel

Data Analytics: which tool first?

Capstone Project: Helping a Business Increase Profits

Data…Data…Everywhere !! Entering into the world of data science (Intro).