devmaxjasper commited on
Commit
e392b9a
·
verified ·
1 Parent(s): a15dd72

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +138 -3
README.md CHANGED
@@ -1,5 +1,140 @@
1
  ---
2
- license: cc-by-4.0
 
 
 
 
 
3
  language:
4
- - en
5
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
+ pretty_name: Spotify Public Playlists (Oct 2024)
3
+ dataset_summary: >-
4
+ CSV export of 91,906 Spotify public playlists captured from a PostgreSQL dump
5
+ in October 2024, including playlist metadata, owner info, follower counts,
6
+ cover images, JSON blobs with the raw Spotify payload, and historical
7
+ snapshots.
8
  language:
9
+ - en
10
+ license: cc-by-4.0
11
+ tags:
12
+ - music
13
+ - spotify
14
+ - playlists
15
+ - tabular-data
16
+ size_categories:
17
+ - 10K<n<100K
18
+ task_categories:
19
+ - tabular-classification
20
+ ---
21
+
22
+ # Spotify Public Playlists (October 2024)
23
+
24
+ This repository contains an open dataset with **91,906** Spotify playlists that
25
+ were present in a PostgreSQL backup captured in **October 2024**. Each row
26
+ represents a playlist and includes high-level metadata (name, owner, follower
27
+ count), cover image URLs, JSON payloads with the full Spotify response, and
28
+ various bookkeeping columns (status, popularity histograms, history, etc.).
29
+
30
+ The dataset ships as a ready-to-use CSV (`playlists.csv`, ~9 GB) along with the
31
+ raw dump (`playlists_full.sql`, 27 GB) and a Python extractor script
32
+ (`export_playlists_to_csv.py`) so anyone can regenerate the CSV from source.
33
+
34
+ > ⚠️ **Attribution + ToS**: This dataset aggregates Spotify metadata originally
35
+ > provided via their APIs. Redistribution is offered under CC BY 4.0, but you are
36
+ > responsible for complying with Spotify's terms of service and ensuring any
37
+ > downstream use respects user privacy.
38
+
39
+ ## Files
40
+
41
+ | Path | Description |
42
+ | --- | --- |
43
+ | `playlists_full.sql` | Original PostgreSQL dump (27 GB) containing `INSERT` statements for every table. |
44
+ | `export_playlists_to_csv.py` | Streaming parser that extracts only `public.playlists` rows into CSV with progress reporting and batching. |
45
+ | `playlists.csv` | Final 91,906-row CSV (17 columns, ~9 GB) with one playlist per row. |
46
+ | `LICENSE` | CC BY 4.0 license text covering this dataset and helper scripts. |
47
+
48
+ ## Schema
49
+
50
+ | Column | Type | Notes |
51
+ | --- | --- | --- |
52
+ | `id` | integer | Autoincrement primary key from the source database. |
53
+ | `playlist_id` | string | Spotify playlist ID. |
54
+ | `name` | string | Playlist display name. |
55
+ | `description` | string | Spotify-provided description (HTML/emoji possible). |
56
+ | `followers_count` | integer | Followers when the snapshot was taken. |
57
+ | `owner_id` | string | Spotify user ID of the owner. |
58
+ | `owner_name` | string | Display name of the owner. |
59
+ | `is_public` | boolean | Whether the playlist was publicly visible. |
60
+ | `tracks_total` | integer | Number of tracks reported by Spotify. |
61
+ | `snapshot_id` | string | Snapshot token returned by Spotify for change tracking. |
62
+ | `image_url` | string | Primary cover image URL. |
63
+ | `raw_data` | JSON (string) | Full Spotify playlist payload as JSON (can exceed 1 MB). |
64
+ | `created_at` | timestamp | When this playlist was inserted into the source DB. |
65
+ | `updated_at` | timestamp | Last time the playlist row was updated. |
66
+ | `followers_history` | JSON (string) | Historical follower counts (if tracked). |
67
+ | `status` | string | ETL status flag from the upstream system. |
68
+ | `popularity_distribution` | JSON (string) | Histogram of track popularity buckets. |
69
+
70
+ ## Regenerating the CSV
71
+
72
+ ```bash
73
+ python3 export_playlists_to_csv.py \
74
+ --batch-size 2000 \
75
+ --progress-interval 0.5
76
+ ```
77
+
78
+ Arguments:
79
+
80
+ - `--batch-size` (default 2000): number of rows buffered before writing to CSV.
81
+ - `--progress-interval` (default 0.25 seconds): how often to refresh the
82
+ progress line.
83
+
84
+ The script streams the SQL file, stops after the playlists table, and prints
85
+ live progress (`rows`, `% of dump read`, and GiB consumed). It sets
86
+ `csv.field_size_limit` to accommodate multi-megabyte JSON blobs.
87
+
88
+ ## Loading the Dataset
89
+
90
+ Once the CSV is available (locally or via Hugging Face), you can load it with
91
+ your favorite data tooling:
92
+
93
+ ```python
94
+ import pandas as pd
95
+
96
+ df = pd.read_csv(
97
+ "playlists.csv",
98
+ dtype={"playlist_id": str, "owner_id": str},
99
+ converters={"raw_data": lambda x: x}, # keep JSON as raw strings
100
+ )
101
+ print(len(df)) # 91906
102
+ ```
103
+
104
+ For streaming workflows (due to the 9 GB size), consider `pyarrow.dataset` or
105
+ chunked `pandas.read_csv(..., chunksize=10_000)`.
106
+
107
+ ## Publishing to Hugging Face
108
+
109
+ 1. **Create dataset repo**: `huggingface-cli repo create <namespace>/spotify-playlists-2024 --type dataset`.
110
+ 2. **Clone with Git LFS**: `GIT_LFS_SKIP_SMUDGE=1 git clone https://huggingface.co/datasets/<namespace>/spotify-playlists-2024` then `cd` into it and run `git lfs install`.
111
+ 3. **Copy assets**: Bring over `playlists.csv`, `export_playlists_to_csv.py`, `README.md`, and `LICENSE`.
112
+ 4. **Track large files**: `git lfs track "*.csv" "*.sql"`. Commit the updated `.gitattributes`.
113
+ 5. **Push**: `git add . && git commit -m "Add Spotify playlists dataset" && git push`.
114
+ 6. **Add metadata**: The `README.md` you are reading doubles as the Hugging Face dataset card, so it will render on the hub automatically.
115
+
116
+ Optional: Upload `playlists_full.sql` as a release artifact or keep it in LFS if
117
+ you want to allow full reproducibility for others.
118
+
119
+ ## License
120
+
121
+ Creative Commons Attribution 4.0 International (CC BY 4.0). See `LICENSE` for
122
+ the full text. When using the dataset, credit “Spotify Public Playlists (Oct 2024)”
123
+ and include a link back to the Hugging Face dataset page or this repository.
124
+
125
+ ## Citation
126
+
127
+ ```
128
+ @dataset{spotify_public_playlists_oct2024,
129
+ title = {Spotify Public Playlists (October 2024)},
130
+ author = {Max and contributors},
131
+ year = {2024},
132
+ howpublished = {Hugging Face Datasets},
133
+ note = {CC-BY 4.0}
134
+ }
135
+ ```
136
+
137
+ ## Contact
138
+
139
+ Questions or takedown requests? Open an issue or reach out via the contact info
140
+ on my Hugging Face profile.