What makes a hit?
Music, in its commercially available form, has been a cornerstone of both creative expression and entertainment since we birthed ears.
Spotify measures danceability, energy, speechiness, acousticness, liveliness, valence, tempo, genre, key, time signature, and a few more. These attributes are one part of the recommendation system that drives further listening on Spotify.
The audience’s ears will always be the final determinant in the popularity of a song, but the attributes and algorithms that drive recommendations affect the discoverability of music.


Radial Chart Depicting Relative Energy
Inclusion on Spotify playlists, of which the audience is in the millions, can thrust a song or artist into the spotlight. Music must be discovered to be heard, and a hit can’t be made if no one is listening.

Historical Attributes
Due to missing tracks from the pre-existing available data sets, I needed to scrape attributes for the top three songs of the last 25 years from the Spotify API directly. Fortunately, there are great Python libraries like Spotipy and Pandas with great documentation from other users for accomplishing similar tasks. Together with the Spotify Web API, Spotipy, and Pandas, I created a playlist on Spotify and pulled all of its songs’ data into an Excel sheet with the following short Python program.
import pandas as pd import spotipy import openpyxl sp = spotipy.Spotify() from spotipy.oauth2 import SpotifyClientCredentials cid =”XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX” secret = “XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX” client_credentials_manager = SpotifyClientCredentials(client_id=cid, client_secret=secret) sp = spotipy.Spotify(client_credentials_manager=client_credentials_ manager) sp.trace=False playlist = sp.user_playlist(“polygnl”, “2RHnfcXrzcI14rOCpmAR6k”) songs = playlist[“tracks”][“items”] ids = [] for i in range(len(songs)):
ids.append(songs[i][“track”][“id”]) features = sp.audio_features(ids) df = pd.DataFrame(features) df.to_excel(“output.xlsx”)