Spotify Data

pandas
python
data-analysis
Author

Marcus Lewis

Published

February 14, 2025

import pandas as pd
spotify = pd.read_csv('https://bcdanl.github.io/data/spotify_all.csv')
spotify
pid playlist_name pos artist_name track_name duration_ms album_name
0 0 Throwbacks 0 Missy Elliott Lose Control (feat. Ciara & Fat Man Scoop) 226863 The Cookbook
1 0 Throwbacks 1 Britney Spears Toxic 198800 In The Zone
2 0 Throwbacks 2 Beyoncé Crazy In Love 235933 Dangerously In Love (Alben für die Ewigkeit)
3 0 Throwbacks 3 Justin Timberlake Rock Your Body 267266 Justified
4 0 Throwbacks 4 Shaggy It Wasn't Me 227600 Hot Shot
... ... ... ... ... ... ... ...
198000 999998 ✝️ 6 Chris Tomlin Waterfall 209573 Love Ran Red
198001 999998 ✝️ 7 Chris Tomlin The Roar 220106 Love Ran Red
198002 999998 ✝️ 8 Crowder Lift Your Head Weary Sinner (Chains) 224666 Neon Steeple
198003 999998 ✝️ 9 Chris Tomlin We Fall Down 280960 How Great Is Our God: The Essential Collection
198004 999998 ✝️ 10 Caleb and Kelsey 10,000 Reasons / What a Beautiful Name 178189 10,000 Reasons / What a Beautiful Name

198005 rows × 7 columns

bey = spotify['artist_name'] == 'Beyoncé'
beyonce_songs= spotify.track_name[bey] #Beyoncé songs only!
track_name
2 Crazy In Love
18 Check On It - feat. Bun B and Slim Thug
342 Single Ladies (Put a Ring on It)
1059 Halo
1079 Drunk in Love
... ...
197084 7/11
197107 Dance for You
197127 Rocket
197521 Single Ladies (Put a Ring on It)
197720 Irreplaceable (Irreemplazable) - Spanish version

591 rows × 1 columns


'Dangerously In Love (Alben für die Ewigkeit)'
bey_album = spotify.album_name == 'Dangerously In Love (Alben für die Ewigkeit)'


(
  spotify[bey_album][['track_name']]
  .value_counts()
)
#Crazy in Love is my favorite song from this album, it was also the most popular track
count
track_name
Crazy In Love 59
Naughty Girl 6
Dangerously In Love 4
Me, Myself and I 3
The Closer I Get to You 3
Speechless 1