Spotify Music Dataset Loading Data
This example loads a Spotify music dataset and displays the first 500 entries as raw JSON text in a `pre` element. The visualization uses a state machine to sequentially render three states: `undefined`, `'LOADING'`, and the parsed data array. It fetches `data.csv`, parses it with `d3.csvParse`, and converts `track_popularity` and `duration_ms` to numbers. Each state transition triggers a re-render via the D3 `select` and `.join` pattern, showing how asynchronous data loading can be handled transparently with D3 v7.
AI-generated descriptionSpotify Music Dataset
This dataset is a subset of the “Spotify Music Dataset” dataset available from Kaggle.
To create this subset, I simply took the first the 500 entries from the data full dataset, and removed some of the columns included. The following are included in this subset:
- track_artist – The artist(s) performing the track (categorical attribute)
- track_popularity – A score from 0–100 based on the track’s relative streaming frequency (quantitative sequential attribute)
- track_album_name – The album in which the track is featured (categorical attribute)
- playlist_name – The name of the playlist where the track is included (categorical attribute)
- track_name – The name of the track (categorical attribute)
- duration_ms – The length of the track in milliseconds (quantitative sequential attribute)
- id – A unique identifier for the song (categorical attribute)