vancenceho/spotify-tracks-clean
收藏资源简介:
--- license: cdla-sharing-1.0 language: - en tags: - music - code pretty_name: Spotify Tracks Cleaned size_categories: - 10K<n<100K --- # Spotify Tracks Cleaned CSV of **Spotify track metadata and audio features** after cleaning for downstream modeling (e.g. viral / popularity prediction, joins with lyrics or YouTube). Rows are unique tracks; the schema follows the common Kaggle-style “Spotify tracks” dump, normalized in `01a_clean_spotify.ipynb`. ## File | File | Role | |------|------| | `spotify_tracks_cleaned.csv` | One row per track; cleaned text fields and consistent dtypes for ML preprocessing. | ## Source - **Upstream:** Spotify track-level table (e.g. `spotify_tracks.csv` from `data/raw/`, or equivalent on Kaggle). - **Pipeline:** `notebooks/01a_clean_spotify.ipynb` — loads raw CSV, applies cleaning, writes to `data/cleaned/spotify_tracks_cleaned.csv`. ## Cleaning (summary) - Strip / normalize whitespace and casing on selected **text** columns (e.g. `artists`, `album_name`, `track_name`, `track_genre`). - Collapse repeated internal spaces; empty strings → missing where appropriate. - Additional steps in the notebook (missing-value handling, typing, deduplication if present) are documented in the notebook cells. ## Schema (typical columns) Exact dtypes may vary by export; expect roughly: | Column | Description | |--------|-------------| | `track_id` | Spotify track identifier (join key). | | `artists`, `album_name`, `track_name` | Text metadata (cleaned). | | `popularity` | Spotify popularity score. | | `duration_ms` | Track length in milliseconds. | | `explicit` | Explicit content flag. | | `danceability` … `time_signature` | Spotify audio features (0–1 or Hz / BPM scales as in the source API export). | | `track_genre` | Genre label (cleaned). | An index column such as `Unnamed: 0` may appear if inherited from the raw CSV. A full Kaggle-style export is often **~114k** rows; if so, use Hub `size_categories` **`100K<n<1M`** instead of the frontmatter value above (adjust the YAML to match your actual file). ## Usage ```python import pandas as pd df = pd.read_csv("spotify_tracks_cleaned.csv") ``` Use `track_id` to align with lyrics, YouTube, or audio-feature tables in the same project. ## Limitations - **Not** real-time Spotify data; snapshot reflects the date of the raw pull. - **License / ToS:** Redistribution must comply with **CDLA-Sharing-1.0** (this card), the original dataset license, and Spotify’s terms of use for derived datasets. ## Citation If you use this artifact in research, cite the original Spotify / Kaggle dataset you built from, and reference your cleaning notebook or repository revision.
license: cdla-sharing-1.0 language: - 英语 tags: - 音乐 - 代码 pretty_name: 清理后的Spotify曲目数据集(Spotify Tracks Cleaned) size_categories: - 10K<n<100K # 清理后的Spotify曲目数据集(Spotify Tracks Cleaned) 本数据集为经过清洗处理的Spotify曲目元数据与音频特征CSV文件,可用于下游建模任务(如热度/流行度预测、与歌词或YouTube数据的关联拼接)。每一行代表一条唯一曲目;数据集结构遵循主流Kaggle风格的“Spotify曲目”导出格式,在`01a_clean_spotify.ipynb`中完成归一化处理。 ## 文件 | 文件 | 用途 | |------|------| | `spotify_tracks_cleaned.csv` | 每一行对应一条曲目;已清洗文本字段并统一数据类型,适配机器学习预处理流程。 | ## 数据源 - **上游数据源:** Spotify曲目层级数据表(例如`data/raw/`目录下的`spotify_tracks.csv`,或Kaggle平台上的等价数据集)。 - **处理流程:** 脚本位于`notebooks/01a_clean_spotify.ipynb` —— 加载原始CSV文件,执行清洗操作后,将结果写入`data/cleaned/spotify_tracks_cleaned.csv`。 ## 清洗说明(摘要) - 对选定的**文本**列(如`artists`、`album_name`、`track_name`、`track_genre`)执行空格剥离、格式归一化与大小写统一操作。 - 合并重复的内部空格;将空字符串按需转换为缺失值。 - 其余清洗步骤(缺失值处理、数据类型校正、重复项去重等)详见Notebook单元格中的文档说明。 ## 字段结构(典型字段) 实际导出的数据类型可能因导出方式有所差异,常见字段大致如下: | 字段名 | 说明 | |--------|-------------| | `track_id` | Spotify曲目标识符(关联键)。 | | `artists`、`album_name`、`track_name` | 已清洗的文本元数据。 | | `popularity` | Spotify流行度评分。 | | `duration_ms` | 曲目时长,单位为毫秒。 | | `explicit` | 露骨内容标记。 | | `danceability` … `time_signature` | Spotify音频特征(取值范围遵循源API导出格式,多为0–1区间或Hz/BPM刻度)。 | | `track_genre` | 已清洗的流派标签。 | 若继承自原始CSV文件,可能会出现`Unnamed: 0`这类冗余索引列。 完整的Kaggle风格导出通常包含**约11.4万**条数据,此时需将数据集规模分类修改为`100K<n<1M`,并同步调整YAML头信息以匹配实际文件大小。 ## 使用示例 python import pandas as pd df = pd.read_csv("spotify_tracks_cleaned.csv") 可使用`track_id`作为关联键,将本数据集与项目中的歌词、YouTube或音频特征数据表进行对齐。 ## 局限性说明 - **非实时数据:** 本数据集的快照为原始数据拉取当日的状态,并非Spotify实时更新的数据。 - **许可证与服务条款:** 重新分发本数据集需遵守**CDLA-Sharing-1.0**(即本数据集卡片)、原始数据集的许可证条款,以及衍生数据集需符合Spotify的使用条款。 ## 引用规范 若在研究中使用本数据集,请引用您所基于的原始Spotify/Kaggle数据集,并注明您所使用的清洗脚本或仓库修订版本。



