Viewing a saved revision (read-only)
b48f552a99bc46069e28df34aa8d7771
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 NYC OpenData.
To create this subset, I filtered the full dataset (approximately 4.42 million rows) to include only motorcycles involved in crashes. I also removed any entries without a listed vehicle model, which reduced the dataset to 223 entries.
While the original dataset contains many more columns, the following are included in this subset:
- UNIQUE_ID – A unique identifier generated by the NYC record system (sequential ordinal attribute)
- CRASH_DATE – The date of the crash (temporal attribute)
- VEHICLE_MAKE – The manufacturer of the motorcycle involved (categorical attribute)
- VEHICLE_MODEL – The model of the motorcycle involved (categorical attribute)
- DRIVER_SEX – The gender of the driver (categorical attribute)
- CONTRIBUTING_FACTOR_1 – A primary factor contributing to the crash (categorical attribute)
- CONTRIBUTING_FACTOR_2 – A secondary factor contributing to the crash (categorical attribute)