Skip to content
Proyek

Tentang

Real, open Pakistan-specific datasets for machine learning, with a scikit-learn style API

AI dan pembelajaran mesin

Cara angka ini diukur

11 bintang1 Fork +1 dalam 24 jam

Pertumbuhan bintang terukur

dalam 24 jam
+1
dalam 7 hari
Mengumpulkan riwayat
dalam 15 hari
Mengumpulkan riwayat
dalam 1 bulan
Mengumpulkan riwayat

Perubahan bersih pada periode yang tumpang tindih, bukan total harian. Pengukuran yang belum tersedia dibiarkan kosong. Bintang menunjukkan perhatian, bukan kualitas.

README.md

Asli

pakdata 🇵🇰

PyPI tests DOI Hugging Face

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.

Website: https://junaidaslam2006.github.io/pakData/ · Use it from any language or tool: docs/USING.md

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
This repo Any language CSV.gz files in pakdata/data/

OpenML (temporarily unavailable)

The OpenML copies (fetch_openml) are offline: in December 2026 OpenML lost every dataset uploaded after 9 November 2026, including these, and its upload service is not accepting new datasets yet. They will be re-uploaded when it is back. Until then, pakdata gives the same scikit-learn objects directly: X, y = load_pak_census_districts(return_X_y=True).

All links per dataset

Dataset Hugging Face Kaggle
pak_weather link link
pak_air_quality link link
pak_census_districts link link
pak_economy link link
pak_crops link link
pak_earthquakes link link
pak_floods_2022 link link
pak_cities link link

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 (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 (the classes, for a classification target), target_column, 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.

Starter notebooks

One per dataset, with charts, a baseline model and the caveats, in kaggle/notebooks/. Run them on Kaggle: kaggle.com/junaidaslam00/code.

Combining datasets

Every province column uses the same official names and the same categories, and pak_floods_2022 has a census_district column, so the census and the floods join directly:

from pakdata import load_pak_census_districts, load_pak_floods_2022

census = load_pak_census_districts(as_frame=True).frame
floods = load_pak_floods_2022(as_frame=True).frame
both = census.merge(floods, left_on="district", right_on="census_district",
                    suffixes=("", "_unosat"))   # 135 of 136 districts

Other joins, explained in the data cards:

  • Cities by name: use ascii_name in pak_cities (plain spelling, e.g. "Muzaffarabad"); name keeps accents.
  • Earthquakes by day: time is UTC; convert it to a Pakistan date before joining the daily date of weather or air quality.
  • Weather + air quality: both carry weather columns from different grid cells; keep the ones from pak_weather.
  • Coordinates are latitude/longitude everywhere except pak_air_quality (latitude_deg/longitude_deg).

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
  • More tabular data: PSX stocks, SBP monthly economic data, rainfall and river flows

Citing pakdata

DOI (always the latest version): 10.5281/zenodo.24662545. Version 0.1.1 specifically: 10.5281/zenodo.24662546.

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.

Jelajahi proyek terkait

Memuat…