Dataset Viewer
Auto-converted to Parquet Duplicate
The dataset viewer is not available for this split.
Cannot load the dataset split (in streaming mode) to extract the first rows.
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 match

Need 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

  1. master_tracks - Unified dataset merging all collections with enriched features (1,217 tracks)
  2. analysis_ready_tracks - Clean, high-quality subset from top 30 artists (155 tracks)
  3. scaled_tracks - Large-scale collection via genre/market searches (979 tracks)
  4. comprehensive_tracks - Regional diversity focus (355 tracks)
  5. popular_tracks - Top tracks from leading artists (100 tracks)

Enriched Datasets

  1. enriched_tracks - Tracks with regional, temporal, and popularity annotations
  2. enriched_artist_summary - Artist-level aggregations with hit ratios and recency
  3. enriched_region_summary - Regional roll-ups with volume and popularity metrics

Artist Datasets

  1. analysis_ready_artists - Artist metadata for top-tier acts
  2. popular_artists - Follower and popularity data for influential artists
  3. artist_summary - Legacy artist aggregations

Specialized Datasets

  1. genre_analysis - Genre-tagged subset for classification tasks
  2. ml_training_popular - High-popularity tracks for supervised learning
  3. temporal_analysis - Year-level aggregations for trend studies
  4. temporal_trends - Time-series data from scaled collection

Network Datasets

  1. artist_network - Curated collaboration networks (JSON)
  2. 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 ID
  • track_name: Track title
  • artist_id: Spotify artist ID
  • artist_name: Artist name
  • album_id: Spotify album ID
  • album_name: Album title
  • album_type: album/single/compilation
  • release_date: Release date (YYYY-MM-DD or YYYY)
  • release_year: Extracted release year
  • popularity: Spotify popularity score (0-100)
  • duration_ms: Track duration in milliseconds
  • explicit: Boolean explicit content flag
  • available_markets: Number of markets where track is available
  • preview_url: URL to 30-second preview
  • spotify_url: Link to Spotify track page

Enriched Fields (enriched_tracks, master_tracks)

  • country: Inferred artist country
  • region: Geographic region (West/East/Southern/Central/North Africa)
  • release_decade: Decade of release
  • release_era: Era classification (Classic/Early Digital/Modern/Contemporary)
  • track_age_years: Age relative to 2025
  • popularity_tier: Hit/Popular/Emerging/Niche
  • market_scope: Global/Regional/Local
  • region_popularity_percentile: Percentile rank within region
  • is_hit: Boolean (popularity >= 70)
  • is_recent: Boolean (released >= 2022)
  • is_classic: Boolean (released < 2000)

Artist-Level Fields

  • artist_id: Spotify artist ID
  • artist_name: Artist name
  • artist_genres: Comma-separated genre list
  • popularity: Artist popularity score (0-100)
  • followers: Total Spotify followers
  • track_count: Number of tracks in dataset
  • avg_popularity: Average track popularity
  • hit_count: Number of hit tracks
  • hit_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:

  1. Curated Artist Lists: Top 30 African superstars (Burna Boy, Wizkid, Davido, etc.)
  2. Genre-Based Search: 15+ African genres (Afrobeats, Amapiano, Bongo Flava, etc.)
  3. Market-Based Search: 10 African markets (Nigeria, South Africa, Kenya, Ghana, etc.)
  4. Regional Crawl: Systematic coverage of 5 geographic regions
  5. 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:

  1. Manual mapping of 60+ headline African artists
  2. ISO market code lookups from search context
  3. 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
92

Collection including electricsheepafrica/Spotify-Africa-Dataset