Tomi Gelo
5 min readSep 27, 2018

“If I were not a physicist, I would probably be a musician. I often think in music. I live my daydreams in music. I see my life in terms of music.”
Albert Einstein

“Kiki, do you analyze me?” — Using Data to Find the Most Popular Tracks of the Summer on Spotify

The way we feel about music may be different from person to person, but when it comes to hard facts like number of sold records or number of streams, there are no two ways about it.

And if you are a data nerd (like me!) you may be interested in those facts for your favorite song. Maybe you even want to know the data behind all the major tracks from the last summer.

If that’s a ‘yes’, then you came to the right place. In this article, I’m going to explain how I utilized music data directly from Spotify itself to find the most popular tracks of the summer 2018.

Note: this article is intended for a general audience without any prior knowledge about programming or APIs. If you are more into coding and stuff there is a more technical version of this article on my personal blog.

APIs and Messengers

In order to get the data for my analysis, I used the official Spotify Web API to retrieve the data and analyse it afterwards with Python.

In a nutshell, an API is a messenger that takes requests and comes back with a response.

A good example is the hotel search engine Trivago who uses APIs from a number of hotels and other similar providers to give you an overview of the best hotel prices.

Similarly, Spotify has its own API which can be used by anyone to build new features or even products on top of this data.

I used the Spotify API to download music data for the months of August and September 2018.

Since the data was in a machine-readable format I had to do some data cleaning and data wrangling in Python. Afterwards, I have set up an so-called cron job using a Linux terminal so that the data gets downloaded on a weekly basis automatically.

If you want to know more about that part you can still visit my personal blog and read about it in more detail.

The final data set had more than 12.000 rows showing the artist/ track names as well as the popularity feature.

What is this ‘popularity’ feature, you might ask? Luckily, the Spotify API documentation has our back:

The popularity of the track. The value will be between 0, for least popular, and 100 for most popular.
The popularity of a track is a value between 0 and 100, with 100 being the most popular. Popularity is based mainly on the total number of playbacks (…)
Note: This value is not updated in real-time and may therefore lag behind in actual popularity.

While it’s not the perfect metric due to it’s rather vague definition and possible lag, this is still the best one available since Spotify doesn’t share the information about the actual number of streams for their tracks (yet?).

Official logos of Spotify and Python

Spotify itself published an article not so long ago where they presented the most streamed songs of the summer 2018. And as it turns out, the tracks selected by Spotify are matching the ones from this analysis.

The smaller difference in the order of the songs might just be due to the different periods of measurement.

Artists and Tracks

Before diving into the most popular tracks, let’s check out who are the artists behind the soundtracks of our summer.

There are several names which have dominated the charts during the summer of 2018. Drake, XXXTENTACION, Post Malone and Travis Scott all have 5 own tracks in the top 100 most popular tracks:

Drake — 5 tracks in top 100
XXXTENTACION — 5 tracks
Travis Scott — 5
Post Malone — 5
Juice WRLD — 3
Khalid — 2
David Guetta — 2
Daddy Yankee — 2
Ozuna — 2
Nicky Jam — 2
Childish Gambino — 2
Selena Gomez — 2
Billie Eilish — 2
Tyga — 2
Zedd — 2

So far, so good. Let’s now look at the most popular tracks of the summer.

For this blog post I will only look into the top 20 tracks. If you are interested in a more in-depth view you can check out this iPython notebook on my Github account used for the analysis.

7th to 20th — this is what summer sounds like

If you are preparing a playlist for your next party, don’t look any further — the top 20 most popular tracks are all you need.

The 20th place is actually shared between ‘Ocean‘ from Martin Garrix and ‘changes’ from XXXTENTACION, which is the third track of the recently-passed-away rapper in the top 20!

Here are also tracks like ‘No Brainer’ and ‘Girls Like You’ (with the latter being the second most streamed song of the summer according to Spotify).

My personal favorite in this group is probably ‘One Kiss’ by Calvin Harris and Dua Lipa.

The song actually sounds like summer in your ears, doesn’t it?

2nd to 6th — a close finish

The next 5 tracks have all scored around 96 out of 100 in popularity on average. Artists like Cardi B, XXXTentacion’s and Post Malone can be found here.

Below is a list of the tracks with the average popularity scores in brackets:

XXXTENTACION — ‘SAD!’ (96)
Cardi B — ‘I Like It’ (96)
Tyga — ‘Taste (feat. Offset)’ (95.67)
Post Malone — ‘Better Now’ (95.67)
Clean Bandit — ‘Solo (feat. Demi Lovato)’ (95.67)

1st — the Drake dominance

No surprise here.

Drake’s viral hit ‘In My Feelings’ has had a perfect score of 100 throughout the measured period.

The Canadian-American rapper managed to leave the competition far behind. If you were looking for the most popular track of the summer, this is the one — without any doubt.

Before you go

If you found this post interesting, please consider clapping a few times so that more people can see it. Also, I would love to hear from you. Best way to reach out to me is on Twitter (@tgel0). Or just respond below this post.

Last but not least, I have added the top 20 tracks from this analysis into a public playlist on Spotify for your convenience: