Spotify is one of the most popular music streaming services, with more than half a billion users around the world. Getting the right music to the right people is essential to the success to the platform, so that users keep using the service. Because of this I have been hired by Spotify to identify music groups and genres that are the most popular, and find songs that fit the same criteria and statistics of those groups, so that they can be recommended by the people using the platform, thus increasing user retention.

The initial data has 23 variables, some of which list information of a song on the streaming service, such as name, release date, artist, as well as other variables that list related information like what album it was from or that albums release date. Other variables, such as energy, key, acousticness, instrumentalness, tempo, length, and liveliness list characteristics of the song.

Data Cleaning

##                 track_id               track_name             track_artist 
##                        0                        5                        5 
##         track_popularity           track_album_id         track_album_name 
##                        0                        0                        5 
## track_album_release_date            playlist_name              playlist_id 
##                        0                        0                        0 
##           playlist_genre        playlist_subgenre             danceability 
##                        0                        0                        0 
##                   energy                      key                 loudness 
##                        0                        0                        0 
##                     mode              speechiness             acousticness 
##                        0                        0                        0 
##         instrumentalness                 liveness                  valence 
##                        0                        0                        0 
##                    tempo              duration_ms 
##                        0                        0

Above, shows the variables with NA values, and upon further inspection it lists 5 rows (or songs) that have missing or incomplete data. These rows have been omitted.Additionally, the variables that relate to albums: track album id, track album name, and track album release date, are somewhat unnecessary for our goal, so these have been omitted as well. There are also songs that might appear twice or more in the data, so multiple occurrences of a song have been dealt with.

Final Data Set

Here is the complete data set that will be used to gauge what songs are popular and what characteristics make it popular.

track_name track_artist track_popularity playlist_name playlist_genre playlist_subgenre danceability energy key loudness mode speechiness acousticness instrumentalness liveness valence tempo duration_ms
I Don’t Care (with Justin Bieber) - Loud Luxury Remix Ed Sheeran 66 Pop Remix pop dance pop 0.748 0.916 6 -2.634 1 0.0583 0.1020 0.00e+00 0.0653 0.518 122.036 194754
Memories - Dillon Francis Remix Maroon 5 67 Pop Remix pop dance pop 0.726 0.815 11 -4.969 1 0.0373 0.0724 4.21e-03 0.3570 0.693 99.972 162600
All the Time - Don Diablo Remix Zara Larsson 70 Pop Remix pop dance pop 0.675 0.931 1 -3.432 0 0.0742 0.0794 2.33e-05 0.1100 0.613 124.008 176616
Call You Mine - Keanu Silva Remix The Chainsmokers 60 Pop Remix pop dance pop 0.718 0.930 7 -3.778 1 0.1020 0.0287 9.40e-06 0.2040 0.277 121.956 169093
Someone You Loved - Future Humans Remix Lewis Capaldi 69 Pop Remix pop dance pop 0.650 0.833 1 -4.672 1 0.0359 0.0803 0.00e+00 0.0833 0.725 123.976 189052
Beautiful People (feat. Khalid) - Jack Wins Remix Ed Sheeran 67 Pop Remix pop dance pop 0.675 0.919 8 -5.385 1 0.1270 0.0799 0.00e+00 0.1430 0.585 124.982 163049
Never Really Over - R3HAB Remix Katy Perry 62 Pop Remix pop dance pop 0.449 0.856 5 -4.788 0 0.0623 0.1870 0.00e+00 0.1760 0.152 112.648 187675
Post Malone (feat. RANI) - GATTÜSO Remix Sam Feldt 69 Pop Remix pop dance pop 0.542 0.903 4 -2.419 0 0.0434 0.0335 4.80e-06 0.1110 0.367 127.936 207619
Tough Love - Tiësto Remix / Radio Edit Avicii 68 Pop Remix pop dance pop 0.594 0.935 8 -3.562 1 0.0565 0.0249 4.00e-06 0.6370 0.366 127.015 193187
If I Can’t Have You - Gryffin Remix Shawn Mendes 67 Pop Remix pop dance pop 0.642 0.818 2 -4.552 1 0.0320 0.0567 0.00e+00 0.0919 0.590 124.957 253040

Overall, all of these variables will be useful for determining the type of song that can be recommended to individuals that are interested in a certain style of music. track_popularity will be the variable that allows us to make our findings, as we can correlate characteristic and categorical variables to see what makes a song popular and which ones to recommend to users.

In this histogram, the track_popularity variable shows that most songs are in the middle of the popularity scale, with a steep drop-off once popularity hits 70. There are also a large number of songs with 0 popularity whatsoever.

Some characteristic variables are energy, acousticness, instrumentalness, and liveness, which help to see what kind of track it is. The categorical variables, such as playlist_genre or track_artist, can help us find out if a recurring variable can be correlated with a higher popularity.

Characteristic N = 32,8281
energy 0.72 (0.58, 0.84)
acousticness 0.08 (0.02, 0.26)
instrumentalness 0.00 (0.00, 0.00)
liveness 0.13 (0.09, 0.25)
1 Median (IQR)

Exploratory Data Analysis

Genre Popularity

To find out what genres are the most popular, we can create a boxplot showing which genres have the most popular songs on average:

This data shows that the ‘latin’ and ‘pop’ genres are the most popular, with ‘edm’ being the least popular.

Energy vs Track Popularity

This data shows the correlation between energy and track_popularity, summarizing that higher energy songs are typically less popular.

Top Artists by Track Popularity

This shows the top artists based on track popularity. These artists should be recommended more often.

Further Analysis

Right now, I want to learn how to see if certain variables are more heavily weighted than others, such as ‘danceability’ vs ‘tempo’. If there is a way to see which variables are preferred by listeners then those should be weighted more heavily when recommending songs to them.

Summary

In this data analysis, the goal was to find out what music groups and criteria were popular, so that those specific songs/artists that relate can be recommended to the appropriate listeners on the Spotify music streaming service. In order to do this, I used a data set of songs with various statistics attached. In order to prepare the data, I had to clean the data, checking for NA values and duplicates, as well as omitting variables that did not relate to my goal. I then created various charts and graphs showing how variables relate to the track_popularity variable, which was the basis of my findings. In my findings, I found that there were artists that had more popular songs than others. I also found that the genre of the song as well as the energy had a distinct effect on the popularity. Latin and Pop songs seemed to be the most popular, along with lower energy songs. During this analysis I was unable to find if certain variables were desired more than others, which would be helpful in recommending songs. Overall, based on my findings I feel that Spotify should be able to make a good recommendation of songs to its users.