Welcome to the Code Your Own Wrapped workshop! In this session, we will transform raw JSON files into a beautiful, interactive data story using Python, Pandas, Matplotlib, Squarify & ipywidgets.
-
Open Google Colab.
-
Upload Notebook. If you have your own dataset, please upload the "Spotify Wrapped Workshop (Real Data)" and if you don't bring your own data the "Spotify Wrapped Workshop (Dummy Data)".
-
Run the Installation and Reading of data cells (provided in the repository) to "read" your music history.
Goal: Create a high-impact visual "Card" showing the total minutes listened.
Logic: We use df['minutes'].sum() to get the total.
Visual: Instead of a chart, we use plt.text to draw a stylized card with the Spotify Green border.
Goal: Rank the top 10 artists by listening time.
Logic: We groupby the Artist Name, sum the minutes, and use nlargest(10) to find the winners.
Visual: A horizontal bar chart. We use Conditional Coloring: the #1 artist is Green, and the rest are Black.
Goal: See how your music habits changed throughout the year.
Logic: We extract the month from the timestamp and reindex them to ensure they appear in order (Jan, Feb, Mar...).
Visual: A line chart. We set the Y-axis to max + 200 so the labels have room to "breathe" at the top.
Goal: Discover your "Power Day" of the week.
Logic: Similar to months, but we group by Day Name (Monday, Tuesday, etc.).
Visual: Vertical bars. The most active day is automatically highlighted in Green.
Goal: Calculate how much music you listen to during "vampire hours."
Logic: We filter the data where the hour is between 0 (midnight) and 4 AM.
Visual: Text summary displaying the total late-night minutes and your top "dark-hour" track.
Goal: Identify the specific tracks you had on repeat.
Logic: Grouping by trackName instead of Artist.
Visual: A sorted horizontal bar chart with data labels showing the exact minutes for each song.
Goal: Find the single day where you listened to the most music.
Logic: We group the data by the specific date and find the max value.
Visual: A narrative reveal of your most legendary listening session.
Goal: Visualize the diversity of your music genres or album names.
Logic: Using the genre (album names) column we created in the enrichment step.
Visual 1: A Treemap. Large rectangles represent dominant genres. We sort them descending so the biggest genre is always in the top-left.
Visual 2: A Bar Chart. Each bar represent album names. We sort them descending so the most listened album name.
Goal: Map your energy levels throughout the 24-hour day.
Logic: Grouping by hour (0-23).
Visual: A line chart with square markers. The peak hour (e.g., 5 PM) is highlighted with a large Green marker.
Goal: Provide a final summary of your musical soul.
Logic: Combining the top artist and a count of unique days active.
Visual: A final "Thank You" message to conclude the presentation.
At the bottom of the script, we use ipywidgets.Button.
The Output Area stays at the top.
The Next Button stays at the bottom. This creates a "Slideshow" experience where the user clicks to reveal the next discovery.