Skip to main content

pakdata 🇵🇰

Real, open, Pakistan-specific datasets for machine learning, loaded the same way as sklearn.datasets.

Nearly every ML tutorial trains on Boston houses, California districts or Pima diabetes patients. pakdata gives students and researchers in Pakistan (and anyone curious about Pakistan) real local data with the same familiar API: Lahore smog, Peshawar summers, the 2023 digital census, wheat yields, the 2005 Kashmir earthquake, the 2022 floods.

from pakdata import load_pak_weather

X, y = load_pak_weather(return_X_y=True)   # exactly like sklearn.datasets.load_*

Every value comes from a named public source, nothing is synthetic or AI-generated, and every dataset ships with a data card that gives its source, license, units, caveats and suggested tasks.

Install

pip install pakdata            # once published to PyPI
pip install pakdata[sklearn]   # also installs scikit-learn

The datasets are bundled inside the package (about 2.8 MB in total), so loading works offline.

Datasets (v0.1.0, snapshot 2026.11)

Loader Rows Features What it is Default target Source License
load_pak_weather 58,448 19 Daily weather, 16 cities across all provinces + GB + AJK, 2016–2025 temp_max_c Open-Meteo / ERA5 (Copernicus) CC BY 4.0
load_pak_air_quality 12,450 21 Daily PM2.5 and other pollutants + weather, 10 cities, 2022-08 to 2025-12 pm2_5_ugm3 Open-Meteo / CAMS (Copernicus) CC BY 4.0
load_pak_census_districts 136 29 2023 digital census: population, growth, literacy, housing per district literacy_rate_pct Pakistan Bureau of Statistics PBS open licence (attribution)
load_pak_economy 66 47 Annual economy & society indicators, 1960–2025 gdp_growth_pct World Bank WDI CC BY 4.0
load_pak_crops 4,202 5 Area, production and yield of 79 crops, 1961–2024 yield_kg_per_ha FAO FAOSTAT CC BY 4.0
load_pak_earthquakes 9,124 16 Earthquakes M≥4 in and around Pakistan, 1973–2025 mag USGS ComCat US Public Domain
load_pak_floods_2022 160 21 Satellite-detected flood extent & population exposed per district, Aug–Sep 2022 flood_extent_sep08_14_km2 UNOSAT via HDX CC BY-SA 4.0
load_pak_cities 575 6 Populated places: location, province, elevation, population log_population GeoNames CC BY 4.0
import pakdata
pakdata.list_datasets()          # this table as a DataFrame
print(pakdata.load_pak_census_districts().DESCR)   # full data card

API

Every load_pak_* function takes the same arguments:

Argument Default Meaning
return_X_y False Return (X, y) instead of a Bunch
as_frame "auto" True gives pandas, False gives numpy, "auto" gives pandas when a feature is text/categorical (same rule as sklearn.datasets.fetch_openml)
target None Predict a different column, e.g. load_pak_cities(target="province") for classification

The returned Bunch has data, target, frame (all columns), feature_names, target_names, DESCR, source, license, version and citation. ID columns, raw dates and columns that would leak the target are kept in frame but left out of data.

from sklearn.linear_model import LinearRegression
from pakdata import load_pak_census_districts

census = load_pak_census_districts(as_frame=True)
model = LinearRegression().fit(census.data.select_dtypes("number"), census.target)

See examples/quickstart.py for four complete beginner exercises.

Honest caveats (read the data cards)

  • Weather and air quality are modelled data (ERA5 reanalysis, CAMS), not ground-station measurements. The Gilgit and Skardu mountain grid cells are much wetter and colder than the valley towns.
  • Time series need time-ordered splits. Use train-on-past, test-on-future for weather, air quality and economy; random splits overstate accuracy.
  • Census 2023 covers the four provinces and ICT. AJK and Gilgit-Baltistan were not in the published results.
  • GeoNames populations have uneven vintages and are not census figures.
  • Floods 2022 contains satellite exposure estimates (UNOSAT), not NDMA damage counts, because no openly licensed district-level damage table exists.

Licenses

The code is MIT. Each data file keeps its source license; see DATA_LICENSES.md. If you redistribute pak_floods_2022 or something derived from it, CC BY-SA 4.0 requires you to share it under the same license. When you publish work that uses a dataset, cite it with bunch.citation.

Reproducibility

Each dataset has a build script at scripts/build_<name>.py. It re-downloads the data from the original source, cleans it the same way and writes the snapshot, so anyone can audit or refresh it. The scripts that call Open-Meteo use its free non-commercial tier. Run them one at a time.

Roadmap

  • Image datasets: number plates, rickshaws/vehicles, local foods, Urdu handwriting
  • NLP datasets: Urdu, Pashto, Hindko and Roman-Urdu text; speech
  • Mirrors on OpenML (so sklearn.datasets.fetch_openml("pak-weather") works), Hugging Face and Kaggle
  • More tabular data: PSX stocks, SBP monthly economic data, rainfall and river flows

Contributing

To add a dataset, follow CONTRIBUTING_DATASET.md. The one rule: real data from a named, openly licensed source, documented honestly.

Metadata

Release files for pakdata 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pakdata 0.1.0
File Size Uploaded Provenance Actions
pakdata-0.1.0.tar.gz 2.9 MB Without provenance Details for pakdata-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pakdata 0.1.0
File Interpreter ABI Platform Actions
pakdata-0.1.0-py3-none-any.whl Python 3 none any Details for pakdata-0.1.0-py3-none-any.whl

Total release size: 5.8 MB

Release files / pakdata-0.1.0.tar.gz

Download URL pakdata-0.1.0.tar.gz
Size 2.9 MB
Tags Source
SHA-256 checksum
How to use checksums
f78feec753b0da8b35da791066cdf0485a31cac52a39959bed7f3b7ed4c1941c
BLAKE2b-256 checksum
How to use checksums
418f4e4b35ccb5e68920657538e4fdd9c56256c912a7b4622134022c2b09ca4b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.9

Release files / pakdata-0.1.0-py3-none-any.whl

Download URL pakdata-0.1.0-py3-none-any.whl
Size 2.9 MB
Tags Python 3
SHA-256 checksum
How to use checksums
2bc79be45dd62a5d0668f6c308eebe4901acfb635ec4e9c681d7625f9ce4e957
BLAKE2b-256 checksum
How to use checksums
6bb075222f1c8be32f3d1b6d8f421607dc4642ae2f188c895c8637bb69a2ef05
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.9

Security for pakdata 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page