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.
Get the data anywhere
| Where | For | How |
|---|---|---|
| PyPI | Python | pip install pakdata |
| Hugging Face | PyTorch / TensorFlow / pandas / DuckDB, online data viewer | load_dataset("junaid008/pak_weather") |
| Kaggle | Notebooks, competitions, CSV download | e.g. Pakistan Census 2023 |
| OpenML | scikit-learn (fetch_openml), R, Julia, Java/Weka |
fetch_openml("pak_census_districts", version=1) (6 of 8, see below) |
| This repo | Any language | CSV.gz files in pakdata/data/ |
Straight from scikit-learn (no pakdata install)
from sklearn.datasets import fetch_openml
census = fetch_openml(data_id=48264, as_frame=True) # same as name="pak_census_districts", version=1
X, y = census.data, census.target
| Dataset | OpenML ID |
|---|---|
| pak_census_districts | 48264 |
| pak_economy | 48265 |
| pak_cities | 48266 |
| pak_crops | 48267 |
| pak_floods_2022 | 48268 |
| pak_earthquakes | 48270 (compact copy: no event_id/time/place text columns) |
pak_weather and pak_air_quality exceed OpenML's upload size limit, so use pakdata, Hugging Face or Kaggle for those.
All links per dataset
| Dataset | Hugging Face | Kaggle | OpenML |
|---|---|---|---|
| pak_weather | link | link | too large |
| pak_air_quality | link | link | too large |
| pak_census_districts | link | link | 48264 |
| pak_economy | link | link | 48265 |
| pak_crops | link | link | 48267 |
| pak_earthquakes | link | link | 48270 |
| pak_floods_2022 | link | link | 48268 |
| pak_cities | link | link | 48266 |
Install
pip install pakdata # Python package
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
Citing pakdata
Use GitHub's "Cite this repository" button (from CITATION.cff), and also cite the
original source of each dataset you use: print(load_pak_weather().citation).
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.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pakdata-0.1.1.tar.gz | 2.9 MB | With provenance | Details for pakdata-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pakdata-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for pakdata-0.1.1-py3-none-any.whl |
Total release size: 5.8 MB
Release files / pakdata-0.1.1.tar.gz
| Download URL | pakdata-0.1.1.tar.gz |
|---|---|
| Size | 2.9 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d41cb16bfc072cb4d57bbef548d548089f7bbd647076c61fd4b3bc92f469abaa
|
|
BLAKE2b-256 checksum How to use checksums |
1d12c0524e4778feacb42e198fa744600a49030bfb2880f853da142cff4b4b01
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.
Transparency logRelease files / pakdata-0.1.1-py3-none-any.whl
| Download URL | pakdata-0.1.1-py3-none-any.whl |
|---|---|
| Size | 2.9 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5e1268c915197aea4fa748ee26d054f7c7b8dd78c4feac70c0b49c3d3e5b23c5
|
|
BLAKE2b-256 checksum How to use checksums |
d19c5a85651965d2468fb28fa630a9a86b82f4b7f542a45dbe8bf32a9db56bb9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.
Transparency logSecurity for pakdata 0.1.1
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.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for pakdata-0.1.1.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.
Transparency logA 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.