Datasets:
The dataset viewer is not available for this split.
Error code: StreamingRowsError
Exception: CastError
Message: Couldn't cast
track_id: string
track_name: string
artist_id: string
artist_name: string
artist_popularity: int64
artist_followers: int64
artist_genres: string
album_id: string
album_name: string
album_type: string
album_release_date: string
release_year: int64
track_number: int64
disc_number: int64
duration_ms: int64
duration_min: double
explicit: bool
popularity: int64
preview_url: double
spotify_url: string
isrc: string
available_markets: int64
collected_date: string
-- schema metadata --
pandas: '{"index_columns": [], "column_indexes": [], "columns": [{"name":' + 2892
to
{'artist_id': Value('string'), 'artist_name': Value('string'), 'genres': Value('string'), 'popularity': Value('int64'), 'followers': Value('int64'), 'spotify_url': Value('string'), 'collected_date': Value('string'), 'related_artists': Value('string'), 'genres_str': Value('string')}
because column names don't match
Traceback: Traceback (most recent call last):
File "/src/services/worker/src/worker/utils.py", line 99, in get_rows_or_raise
return get_rows(
^^^^^^^^^
File "/src/libs/libcommon/src/libcommon/utils.py", line 272, in decorator
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/src/services/worker/src/worker/utils.py", line 77, in get_rows
rows_plus_one = list(itertools.islice(ds, rows_max_number + 1))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/datasets/iterable_dataset.py", line 2431, in __iter__
for key, example in ex_iterable:
^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/datasets/iterable_dataset.py", line 1952, in __iter__
for key, pa_table in self._iter_arrow():
^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/datasets/iterable_dataset.py", line 1975, in _iter_arrow
for key, pa_table in self.ex_iterable._iter_arrow():
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/datasets/iterable_dataset.py", line 503, in _iter_arrow
for key, pa_table in iterator:
^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/datasets/iterable_dataset.py", line 350, in _iter_arrow
for key, pa_table in self.generate_tables_fn(**gen_kwags):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/datasets/packaged_modules/parquet/parquet.py", line 106, in _generate_tables
yield f"{file_idx}_{batch_idx}", self._cast_table(pa_table)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/datasets/packaged_modules/parquet/parquet.py", line 73, in _cast_table
pa_table = table_cast(pa_table, self.info.features.arrow_schema)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/datasets/table.py", line 2272, in table_cast
return cast_table_to_schema(table, schema)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/datasets/table.py", line 2218, in cast_table_to_schema
raise CastError(
datasets.table.CastError: Couldn't cast
track_id: string
track_name: string
artist_id: string
artist_name: string
artist_popularity: int64
artist_followers: int64
artist_genres: string
album_id: string
album_name: string
album_type: string
album_release_date: string
release_year: int64
track_number: int64
disc_number: int64
duration_ms: int64
duration_min: double
explicit: bool
popularity: int64
preview_url: double
spotify_url: string
isrc: string
available_markets: int64
collected_date: string
-- schema metadata --
pandas: '{"index_columns": [], "column_indexes": [], "columns": [{"name":' + 2892
to
{'artist_id': Value('string'), 'artist_name': Value('string'), 'genres': Value('string'), 'popularity': Value('int64'), 'followers': Value('int64'), 'spotify_url': Value('string'), 'collected_date': Value('string'), 'related_artists': Value('string'), 'genres_str': Value('string')}
because column names don't matchNeed help to make the dataset viewer work? Make sure to review how to configure the dataset viewer, and open a discussion for direct support.
Spotify-Africa Music Dataset 🎵🌍
A comprehensive, research-grade dataset documenting African music from Spotify spanning 1,600+ tracks, 650+ artists, and 67 years of musical history (1958-2025).
Dataset Summary
This dataset provides rich metadata about African music across multiple genres, regions, and time periods. It includes track-level information, artist metadata, temporal trends, regional summaries, and network relationships. The data was collected via the Spotify Web API and enriched with derived features for immediate research use.
Key Statistics
- Total Tracks: 1,600+ unique tracks
- Artists: 650+ African artists
- Geographic Coverage: 5 regions (West, East, Southern, Central, North Africa)
- Temporal Span: 1958-2025 (67 years)
- Genres: 15+ African music genres including Afrobeats, Amapiano, Bongo Flava, Highlife, Gqom
- Data Quality: 92% metadata completeness
- Popular Tracks: 314 tracks with popularity >50
Supported Tasks
- Music Genre Classification: Train models to identify African music genres
- Popularity Prediction: Predict track success based on metadata
- Temporal Trend Analysis: Study the evolution of African music over decades
- Regional Comparison: Compare music characteristics across African regions
- Artist Network Analysis: Map collaboration and influence patterns
- Market Analysis: Study track availability and penetration across markets
Dataset Structure
Available Datasets
The collection is organized into 20 curated datasets, each optimized for specific research tasks:
Core Track Datasets
- master_tracks - Unified dataset merging all collections with enriched features (1,217 tracks)
- analysis_ready_tracks - Clean, high-quality subset from top 30 artists (155 tracks)
- scaled_tracks - Large-scale collection via genre/market searches (979 tracks)
- comprehensive_tracks - Regional diversity focus (355 tracks)
- popular_tracks - Top tracks from leading artists (100 tracks)
Enriched Datasets
- enriched_tracks - Tracks with regional, temporal, and popularity annotations
- enriched_artist_summary - Artist-level aggregations with hit ratios and recency
- enriched_region_summary - Regional roll-ups with volume and popularity metrics
Artist Datasets
- analysis_ready_artists - Artist metadata for top-tier acts
- popular_artists - Follower and popularity data for influential artists
- artist_summary - Legacy artist aggregations
Specialized Datasets
- genre_analysis - Genre-tagged subset for classification tasks
- ml_training_popular - High-popularity tracks for supervised learning
- temporal_analysis - Year-level aggregations for trend studies
- temporal_trends - Time-series data from scaled collection
Network Datasets
- artist_network - Curated collaboration networks (JSON)
- artist_networks - Raw related-artist mappings (JSON)
Each dataset is available in both CSV and Parquet formats, with accompanying documentation in dataset_card.md.
Data Fields
Track-Level Fields (master_tracks, enriched_tracks, etc.)
track_id: Spotify track IDtrack_name: Track titleartist_id: Spotify artist IDartist_name: Artist namealbum_id: Spotify album IDalbum_name: Album titlealbum_type: album/single/compilationrelease_date: Release date (YYYY-MM-DD or YYYY)release_year: Extracted release yearpopularity: Spotify popularity score (0-100)duration_ms: Track duration in millisecondsexplicit: Boolean explicit content flagavailable_markets: Number of markets where track is availablepreview_url: URL to 30-second previewspotify_url: Link to Spotify track page
Enriched Fields (enriched_tracks, master_tracks)
country: Inferred artist countryregion: Geographic region (West/East/Southern/Central/North Africa)release_decade: Decade of releaserelease_era: Era classification (Classic/Early Digital/Modern/Contemporary)track_age_years: Age relative to 2025popularity_tier: Hit/Popular/Emerging/Nichemarket_scope: Global/Regional/Localregion_popularity_percentile: Percentile rank within regionis_hit: Boolean (popularity >= 70)is_recent: Boolean (released >= 2022)is_classic: Boolean (released < 2000)
Artist-Level Fields
artist_id: Spotify artist IDartist_name: Artist nameartist_genres: Comma-separated genre listpopularity: Artist popularity score (0-100)followers: Total Spotify followerstrack_count: Number of tracks in datasetavg_popularity: Average track popularityhit_count: Number of hit trackshit_ratio: Proportion of tracks that are hits
Data Splits
No predefined train/validation/test splits are provided. Users should create splits appropriate to their research questions, considering:
- Temporal splits: Train on pre-2020, test on 2020+
- Regional splits: Train on specific regions, test on others
- Artist-based splits: Prevent artist leakage across splits
- Popularity-stratified splits: Ensure balanced representation
Dataset Creation
Source Data
Data was collected from the Spotify Web API between October 2025, targeting African music across multiple collection strategies:
- Curated Artist Lists: Top 30 African superstars (Burna Boy, Wizkid, Davido, etc.)
- Genre-Based Search: 15+ African genres (Afrobeats, Amapiano, Bongo Flava, etc.)
- Market-Based Search: 10 African markets (Nigeria, South Africa, Kenya, Ghana, etc.)
- Regional Crawl: Systematic coverage of 5 geographic regions
- Network Expansion: Related artist mappings for collaboration analysis
Collection Methodology
- Rate-Limited API Calls: Respectful polling with exponential backoff
- Deduplication: Track IDs deduplicated across collection runs
- Quality Filtering: Manual curation of artist lists for regional representation
- Enrichment Pipeline: Post-processing to infer geographic and temporal metadata
Annotations
Regional Inference
Artist countries and regions were inferred using:
- Manual mapping of 60+ headline African artists
- ISO market code lookups from search context
- Spotify market availability heuristics
Temporal Annotations
Release eras classified as:
- Classic (pre-2000): Traditional and heritage music
- Early Digital (2000-2009): Transition to digital distribution
- Modern (2010-2019): Golden age of Afrobeats globalization
- Contemporary (2020-2025): Current streaming era
Popularity Tiers
Tracks categorized by Spotify popularity scores:
- Hit (70-100): Mainstream chart success
- Popular (50-69): Strong audience engagement
- Emerging (30-49): Growing traction
- Niche (0-29): Specialized or catalog content
Data Quality
- Metadata Completeness: 92%
- Popularity Scores Available: 85% of tracks
- Release Date Coverage: 98% of tracks
- Genre Labels: 70% of tracks
- Regional Tagging: 100% (via inference)
Known Limitations:
- Audio features (tempo, danceability, energy, etc.) unavailable due to Spotify API restrictions
- Central and North Africa underrepresented (Spotify penetration lower)
- Pre-2000 historical music coverage limited (150 tracks)
- Focus on mainstream artists; independent/underground scenes undersampled
Usage
Loading the Dataset
Using Pandas
import pandas as pd
# Load master track dataset (CSV)
df = pd.read_csv('data/datasets/master_tracks/master_tracks_20251030_135608.csv')
# Or use Parquet for faster loading
df = pd.read_parquet('data/datasets/master_tracks/master_tracks_20251030_135608.parquet')
print(f"Loaded {len(df):,} tracks")
print(df.head())
Using Hugging Face Datasets
from datasets import load_dataset
# Load specific dataset
dataset = load_dataset('electricsheepafrica/Spotify-Africa-Dataset', data_files='data/datasets/master_tracks/*.parquet')
# Access as pandas DataFrame
df = dataset['train'].to_pandas()
Example Analyses
1. Genre Distribution
import matplotlib.pyplot as plt
# Load genre-tagged tracks
df = pd.read_parquet('data/datasets/genre_analysis/genre_analysis_20251030_134044.parquet')
# Count tracks per genre
genres = df['artist_genres'].str.split(', ', expand=True).stack()
top_genres = genres.value_counts().head(10)
top_genres.plot(kind='barh', title='Top 10 African Music Genres')
plt.xlabel('Track Count')
plt.show()
2. Popularity Prediction
from sklearn.model_selection import train_test_split
from sklearn.ensemble import RandomForestRegressor
# Load ML training set
df = pd.read_parquet('data/datasets/ml_training_popular/*.parquet')
# Prepare features
X = df[['release_year', 'duration_ms', 'explicit', 'available_markets']]
y = df['popularity']
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42)
# Train model
model = RandomForestRegressor(n_estimators=100, random_state=42)
model.fit(X_train, y_train)
print(f"R² Score: {model.score(X_test, y_test):.3f}")
3. Temporal Trends
import seaborn as sns
# Load temporal analysis
df = pd.read_csv('data/datasets/temporal_analysis/*.csv')
plt.figure(figsize=(12, 6))
plt.plot(df['release_year'], df['avg_popularity'], marker='o')
plt.title('Average Track Popularity Over Time')
plt.xlabel('Year')
plt.ylabel('Avg Popularity Score')
plt.grid(True, alpha=0.3)
plt.show()
4. Regional Comparison
# Load enriched tracks
df = pd.read_parquet('data/datasets/enriched_tracks/*.parquet')
# Compare regions
regional_stats = df.groupby('region').agg({
'track_id': 'count',
'popularity': 'mean',
'is_hit': 'mean'
}).round(2)
print(regional_stats)
Citation
If you use this dataset in your research, please cite:
@dataset{spotify_africa_dataset_2025,
title={Spotify-Africa Music Dataset: A Comprehensive Collection of African Music Metadata},
author={Spotify-Africa Dataset Project},
year={2025},
publisher={Hugging Face},
howpublished={\url{https://huggingface.co/datasets/electricsheepafrica/Spotify-Africa-Dataset}}
}
Licensing
This dataset is released under CC BY 4.0 (Creative Commons Attribution 4.0 International).
You are free to:
- Share — copy and redistribute the material
- Adapt — remix, transform, and build upon the material
Under the following terms:
- Attribution — You must give appropriate credit and indicate if changes were made
Note: Track previews and Spotify links are subject to Spotify's Terms of Service. This dataset contains metadata only, not audio files.
Ethical Considerations
Representation
- Geographic Bias: West and Southern Africa heavily represented; Central and North Africa undersampled
- Platform Bias: Dataset reflects Spotify's catalog and recommendation algorithms
- Mainstream Bias: Focus on popular artists; independent labels and emerging artists underrepresented
- Language: Track and artist names in original languages (English, Yoruba, Zulu, Swahili, Arabic, etc.)
Intended Use
Recommended:
- Academic research on African music evolution and globalization
- Music recommendation system development
- Cultural heritage documentation
- Market analysis for music industry professionals
- Educational materials on African music diversity
Not Recommended:
- Claiming dataset represents "all" African music
- Making cultural generalizations based solely on this data
- Commercial use without proper attribution
- Reproducing Spotify proprietary metrics without permission
Privacy
- Only public Spotify metadata is included
- No user listening data or personally identifiable information
- All artist/track IDs are public Spotify identifiers
Updates and Maintenance
- Last Updated: October 30, 2025
- Version: 1.0.0
- Refresh Cadence: Dataset is a point-in-time snapshot; popularity scores and market availability will drift
To request updates or report issues, please open an issue on the repository.
Acknowledgments
- Data Source: Spotify Web API
- Regional Expertise: Curated artist lists informed by music journalism and industry knowledge
- Tools: Python, pandas, spotipy, pyarrow
Special thanks to the African music community for creating this incredible body of work.
Contact
For questions, collaborations, or dataset extensions, please reach out via the repository issues or discussions.
Repository: https://huggingface.co/datasets/electricsheepafrica/Spotify-Africa-Dataset
Explore African Music. Celebrate Diversity. Amplify Voices. 🌍🎶
- Downloads last month
- 90