Datasets:
crop large_stringclasses 79
values | crop_group large_stringclasses 11
values | fao_item_code int64 15 826 | year int64 1.96k 2.02k | area_harvested_ha float64 4 9.73M | area_harvested_flag large_stringclasses 4
values | production_tonnes float64 2 88.7M | production_flag large_stringclasses 4
values | yield_kg_per_ha float64 219 74.3k | yield_flag large_stringclasses 3
values |
|---|---|---|---|---|---|---|---|---|---|
Almonds, in shell | tree_nut | 221 | 1,961 | 3,200 | E | 9,000 | E | 2,812.5 | E |
Almonds, in shell | tree_nut | 221 | 1,962 | 3,400 | E | 9,500 | E | 2,794.1 | E |
Almonds, in shell | tree_nut | 221 | 1,963 | 3,600 | E | 10,000 | E | 2,777.8 | E |
Almonds, in shell | tree_nut | 221 | 1,964 | 3,800 | E | 10,500 | E | 2,763.2 | E |
Almonds, in shell | tree_nut | 221 | 1,965 | 4,000 | E | 11,000 | E | 2,750 | E |
Almonds, in shell | tree_nut | 221 | 1,966 | 4,100 | E | 11,500 | E | 2,804.9 | E |
Almonds, in shell | tree_nut | 221 | 1,967 | 4,200 | E | 12,000 | E | 2,857.1 | E |
Almonds, in shell | tree_nut | 221 | 1,968 | 4,400 | E | 12,500 | E | 2,840.9 | E |
Almonds, in shell | tree_nut | 221 | 1,969 | 4,600 | E | 13,000 | E | 2,826.1 | E |
Almonds, in shell | tree_nut | 221 | 1,970 | 4,800 | E | 14,000 | E | 2,916.7 | E |
Almonds, in shell | tree_nut | 221 | 1,971 | 5,000 | E | 15,000 | E | 3,000 | E |
Almonds, in shell | tree_nut | 221 | 1,972 | 5,200 | A | 15,400 | A | 2,961.5 | A |
Almonds, in shell | tree_nut | 221 | 1,973 | 5,400 | A | 19,000 | E | 3,518.5 | E |
Almonds, in shell | tree_nut | 221 | 1,974 | 5,800 | A | 27,100 | A | 4,672.4 | A |
Almonds, in shell | tree_nut | 221 | 1,975 | 5,900 | A | 22,100 | A | 3,745.8 | A |
Almonds, in shell | tree_nut | 221 | 1,976 | 6,100 | A | 22,200 | A | 3,639.3 | A |
Almonds, in shell | tree_nut | 221 | 1,977 | 6,200 | A | 24,200 | A | 3,903.2 | A |
Almonds, in shell | tree_nut | 221 | 1,978 | 6,300 | A | 22,300 | A | 3,539.7 | A |
Almonds, in shell | tree_nut | 221 | 1,979 | 6,300 | A | 23,000 | A | 3,650.8 | A |
Almonds, in shell | tree_nut | 221 | 1,980 | 6,400 | A | 23,600 | A | 3,687.5 | A |
Almonds, in shell | tree_nut | 221 | 1,981 | 6,408 | A | 21,170 | A | 3,303.7 | A |
Almonds, in shell | tree_nut | 221 | 1,982 | 6,459 | A | 23,293 | A | 3,606.3 | A |
Almonds, in shell | tree_nut | 221 | 1,983 | 6,526 | A | 27,073 | A | 4,148.5 | A |
Almonds, in shell | tree_nut | 221 | 1,984 | 6,700 | A | 28,000 | A | 4,179.1 | A |
Almonds, in shell | tree_nut | 221 | 1,985 | 6,900 | A | 28,500 | A | 4,130.4 | A |
Almonds, in shell | tree_nut | 221 | 1,986 | 7,000 | A | 29,200 | A | 4,171.4 | A |
Almonds, in shell | tree_nut | 221 | 1,987 | 7,200 | A | 29,300 | A | 4,069.4 | A |
Almonds, in shell | tree_nut | 221 | 1,988 | 7,300 | A | 29,800 | A | 4,082.2 | A |
Almonds, in shell | tree_nut | 221 | 1,989 | 7,500 | A | 30,100 | A | 4,013.3 | A |
Almonds, in shell | tree_nut | 221 | 1,990 | 7,500 | A | 30,900 | A | 4,120 | A |
Almonds, in shell | tree_nut | 221 | 1,991 | 7,552 | A | 32,400 | A | 4,290.3 | A |
Almonds, in shell | tree_nut | 221 | 1,992 | 8,623 | A | 38,304 | A | 4,442.1 | A |
Almonds, in shell | tree_nut | 221 | 1,993 | 9,087 | A | 40,043 | A | 4,406.6 | A |
Almonds, in shell | tree_nut | 221 | 1,994 | 10,258 | A | 45,193 | A | 4,405.6 | A |
Almonds, in shell | tree_nut | 221 | 1,995 | 10,320 | A | 48,996 | A | 4,747.7 | A |
Almonds, in shell | tree_nut | 221 | 1,996 | 10,454 | A | 49,356 | A | 4,721.3 | A |
Almonds, in shell | tree_nut | 221 | 1,997 | 10,600 | A | 49,000 | A | 4,622.6 | A |
Almonds, in shell | tree_nut | 221 | 1,998 | 10,666 | A | 49,120 | A | 4,605.3 | A |
Almonds, in shell | tree_nut | 221 | 1,999 | 10,771 | A | 50,015 | A | 4,643.5 | A |
Almonds, in shell | tree_nut | 221 | 2,000 | 10,732 | A | 32,336 | A | 3,013 | A |
Almonds, in shell | tree_nut | 221 | 2,001 | 10,984 | A | 33,236 | A | 3,025.9 | A |
Almonds, in shell | tree_nut | 221 | 2,002 | 9,560 | A | 26,414 | A | 2,763 | A |
Almonds, in shell | tree_nut | 221 | 2,003 | 9,231 | A | 23,688 | A | 2,566.1 | A |
Almonds, in shell | tree_nut | 221 | 2,004 | 10,120 | A | 23,924 | A | 2,364 | A |
Almonds, in shell | tree_nut | 221 | 2,005 | 10,277 | A | 23,129 | A | 2,250.6 | A |
Almonds, in shell | tree_nut | 221 | 2,006 | 10,362 | A | 23,344 | A | 2,252.8 | A |
Almonds, in shell | tree_nut | 221 | 2,007 | 10,817 | A | 23,382 | A | 2,161.6 | A |
Almonds, in shell | tree_nut | 221 | 2,008 | 11,060 | A | 26,614 | A | 2,406.3 | A |
Almonds, in shell | tree_nut | 221 | 2,009 | 11,000 | A | 26,400 | A | 2,400 | A |
Almonds, in shell | tree_nut | 221 | 2,010 | 10,939 | A | 21,935 | A | 2,005.2 | A |
Almonds, in shell | tree_nut | 221 | 2,011 | 10,790 | A | 21,465 | A | 1,989.3 | A |
Almonds, in shell | tree_nut | 221 | 2,012 | 10,809 | A | 21,440 | A | 1,983.5 | A |
Almonds, in shell | tree_nut | 221 | 2,013 | 10,574 | A | 22,330 | A | 2,111.8 | A |
Almonds, in shell | tree_nut | 221 | 2,014 | 10,652 | A | 21,649 | A | 2,032.4 | A |
Almonds, in shell | tree_nut | 221 | 2,015 | 10,624 | A | 21,881 | A | 2,059.6 | A |
Almonds, in shell | tree_nut | 221 | 2,016 | 10,465 | A | 21,451 | A | 2,049.8 | A |
Almonds, in shell | tree_nut | 221 | 2,017 | 10,268 | A | 21,747 | A | 2,117.9 | A |
Almonds, in shell | tree_nut | 221 | 2,018 | 9,602 | A | 19,994 | A | 2,082.3 | A |
Almonds, in shell | tree_nut | 221 | 2,019 | 9,010 | A | 20,027 | A | 2,222.8 | A |
Almonds, in shell | tree_nut | 221 | 2,020 | 8,791 | A | 21,094 | A | 2,399.5 | A |
Almonds, in shell | tree_nut | 221 | 2,021 | 8,358 | A | 18,570 | A | 2,221.8 | A |
Almonds, in shell | tree_nut | 221 | 2,022 | 7,802 | A | 18,106 | A | 2,320.7 | A |
Almonds, in shell | tree_nut | 221 | 2,023 | 7,809 | A | 17,345 | A | 2,221.2 | A |
Almonds, in shell | tree_nut | 221 | 2,024 | 7,821 | I | 16,757.33 | I | 2,142.6 | E |
Apples | fruit | 515 | 1,961 | 1,400 | A | 11,500 | A | 8,214.3 | A |
Apples | fruit | 515 | 1,962 | 1,900 | A | 8,000 | A | 4,210.5 | A |
Apples | fruit | 515 | 1,963 | 3,200 | A | 18,900 | A | 5,906.3 | A |
Apples | fruit | 515 | 1,964 | 3,800 | A | 12,600 | A | 3,315.8 | A |
Apples | fruit | 515 | 1,965 | 4,200 | A | 16,100 | A | 3,833.3 | A |
Apples | fruit | 515 | 1,966 | 3,000 | A | 20,700 | A | 6,900 | A |
Apples | fruit | 515 | 1,967 | 3,400 | A | 21,300 | A | 6,264.7 | A |
Apples | fruit | 515 | 1,968 | 3,600 | A | 23,700 | A | 6,583.3 | A |
Apples | fruit | 515 | 1,969 | 3,844 | A | 31,900 | A | 8,298.6 | A |
Apples | fruit | 515 | 1,970 | 4,168 | A | 33,430 | A | 8,020.6 | A |
Apples | fruit | 515 | 1,971 | 4,520 | A | 36,127 | A | 7,992.7 | A |
Apples | fruit | 515 | 1,972 | 5,060 | A | 34,240 | A | 6,766.8 | A |
Apples | fruit | 515 | 1,973 | 6,167 | A | 51,510 | A | 8,352.5 | A |
Apples | fruit | 515 | 1,974 | 7,156 | A | 56,245 | A | 7,859.8 | A |
Apples | fruit | 515 | 1,975 | 8,021 | A | 66,690 | A | 8,314.4 | A |
Apples | fruit | 515 | 1,976 | 8,784 | A | 74,746 | A | 8,509.3 | A |
Apples | fruit | 515 | 1,977 | 9,719 | A | 87,672 | A | 9,020.7 | A |
Apples | fruit | 515 | 1,978 | 10,251 | A | 93,718 | A | 9,142.3 | A |
Apples | fruit | 515 | 1,979 | 10,854 | A | 99,282 | A | 9,147 | A |
Apples | fruit | 515 | 1,980 | 11,374 | A | 107,410 | A | 9,443.5 | A |
Apples | fruit | 515 | 1,981 | 11,872 | A | 114,095 | A | 9,610.4 | A |
Apples | fruit | 515 | 1,982 | 12,931 | A | 128,616 | A | 9,946.3 | A |
Apples | fruit | 515 | 1,983 | 13,304 | A | 128,068 | A | 9,626.3 | A |
Apples | fruit | 515 | 1,984 | 14,832 | A | 142,659 | A | 9,618.3 | A |
Apples | fruit | 515 | 1,985 | 17,422 | A | 166,043 | A | 9,530.7 | A |
Apples | fruit | 515 | 1,986 | 18,491 | A | 195,573 | A | 10,576.7 | A |
Apples | fruit | 515 | 1,987 | 19,098 | A | 211,942 | A | 11,097.6 | A |
Apples | fruit | 515 | 1,988 | 21,800 | A | 215,113 | A | 9,867.6 | A |
Apples | fruit | 515 | 1,989 | 22,390 | A | 232,404 | A | 10,379.8 | A |
Apples | fruit | 515 | 1,990 | 22,800 | A | 243,000 | A | 10,657.9 | A |
Apples | fruit | 515 | 1,991 | 27,865 | A | 293,500 | A | 10,532.9 | A |
Apples | fruit | 515 | 1,992 | 31,384 | A | 338,968 | A | 10,800.7 | A |
Apples | fruit | 515 | 1,993 | 39,464 | A | 442,395 | A | 11,210.1 | A |
Apples | fruit | 515 | 1,994 | 40,394 | A | 533,105 | A | 13,197.6 | A |
Apples | fruit | 515 | 1,995 | 41,777 | A | 553,474 | A | 13,248.3 | A |
Apples | fruit | 515 | 1,996 | 43,506 | A | 568,452 | A | 13,066.1 | A |
Pakistan crop statistics: area, production and yield of 79 crops, 1961-2024 (FAOSTAT)
Part of pakdata, a collection of real, openly licensed Pakistan-specific datasets for machine learning. Every value comes from the named public source below; nothing is synthetic or AI-generated.
| Rows | 4,202 |
| Default target | yield_kg_per_ha (regression) |
| Source | FAO (FAOSTAT, Production: Crops and livestock products, QCL) |
| License | CC BY 4.0 (FAO Statistical Database Terms of Use) |
| Snapshot | 2026.11 |
Load it
# pakdata (scikit-learn style, works offline) pip install pakdata
from pakdata import load_pak_crops
X, y = load_pak_crops(return_X_y=True)
# Hugging Face datasets (also gives PyTorch / TensorFlow / JAX formats)
from datasets import load_dataset
ds = load_dataset("junaid008/pak_crops", split="train")
torch_ds = ds.with_format("torch")
# pandas / Polars / DuckDB, straight from the Hub
import pandas as pd; df = pd.read_parquet("hf://datasets/junaid008/pak_crops/data/train.parquet")
import polars as pl; df = pl.read_parquet("hf://datasets/junaid008/pak_crops/data/train.parquet")
import duckdb; duckdb.sql("SELECT * FROM 'hf://datasets/junaid008/pak_crops/data/train.parquet'")
Plain CSV (Excel, R, Julia, MATLAB, SPSS, anything):
https://huggingface.co/datasets/junaid008/pak_crops/resolve/main/csv/pak_crops.csv
df <- read.csv("https://huggingface.co/datasets/junaid008/pak_crops/resolve/main/csv/pak_crops.csv")
JSON API (JavaScript, mobile apps, any language):
https://datasets-server.huggingface.co/rows?dataset=junaid008/pak_crops&config=default&split=train&offset=0&length=100
Features used by pakdata: crop, crop_group, year, area_harvested_ha, area_harvested_flag
Kept in the table but not used as features (ids, raw dates, or columns that would leak the target): fao_item_code, production_tonnes, production_flag, yield_flag
Data card
The full data card (column meanings and units, how it was built, caveats, suggested tasks):
.. _pak_crops_dataset:
Pakistan crop statistics (FAOSTAT), 1961-2024
---------------------------------------------
Harvested area, production and yield of every primary crop FAO reports for
Pakistan, one row per (crop, year), with FAO's data-quality flag on every value.
**Data Set Characteristics:**
:Number of Instances: 4202 (79 crops x up to 64 years)
:Number of Attributes: 5 features (``crop``, ``crop_group``, ``year``, ``area_harvested_ha``, ``area_harvested_flag``) + target; 4 more columns kept in ``frame`` only
:Default target: ``yield_kg_per_ha`` (kg per hectare)
:Time coverage: 1961-2024 (annual; coverage varies by crop, see Caveats)
:Geographic coverage: Pakistan, national totals (FAO area code 165); no provincial breakdown
:Source: Food and Agriculture Organization of the United Nations (FAO), FAOSTAT domain QCL "Production: Crops and livestock products", last updated 2025-12-31. https://www.fao.org/faostat/en/#data/QCL ; bulk file https://bulks-faostat.fao.org/production/Production_Crops_Livestock_E_Asia.zip
:License: CC BY 4.0, complemented by the FAO Statistical Database Terms of Use, https://www.fao.org/contact-us/terms/db-terms-of-use/en/ (redistribution permitted with attribution; no implied FAO endorsement; no commercial promotion)
:Snapshot: 2026.11 (retrieved 2026-11-29)
**Columns:**
- ``crop`` (category): FAO item name exactly as published, e.g. ``Wheat``, ``Rice`` (= rice paddy), ``Seed cotton, unginned``, ``Sugar cane``, ``Maize (corn)``, ``Chick peas, dry``, ``Mangoes, guavas and mangosteens``, ``Tangerines, mandarins, clementines`` (FAO's item for kinnow), ``Oranges``, ``Dates``, ``Potatoes``, ``Onions and shallots, dry (excluding dehydrated)``.
- ``crop_group`` (category): pakdata grouping of the FAO item, following FAOSTAT's commodity aggregates: ``cereal`` (6 crops), ``pulse`` (6), ``fibre`` (3), ``sugar`` (2), ``oilseed`` (12, includes coconuts and olives, as in FAO "Oilcrops"), ``root_tuber`` (3), ``vegetable`` (17, includes melons and watermelons), ``fruit`` (22), ``tree_nut`` (4), ``spice`` (3), ``stimulant`` (1, tobacco). This is the only column not taken from FAO.
- ``fao_item_code`` (int): FAOSTAT item code (identifier; excluded from features).
- ``year`` (int): calendar year of the FAO record.
- ``area_harvested_ha`` (hectares): area harvested.
- ``area_harvested_flag`` (category): FAO flag for the area value.
- ``production_tonnes`` (tonnes): production quantity. **Excluded from features**: FAO's yield is production / area, so production and area together give the target exactly.
- ``production_flag`` (category): FAO flag for production (excluded from features).
- ``yield_kg_per_ha`` (kg/ha): yield as published by FAO (target).
- ``yield_flag`` (category): FAO flag for yield (excluded from features, it describes the target).
FAO flag codes: ``A`` = official figure; ``E`` = estimated value (FAO estimate);
``I`` = value imputed by a receiving agency; ``X`` = figure from an external
organization (in this file every ``X`` yield/production value from the early
decades is also annotated by FAO as an "unofficial figure"; that note is not
kept as a column). Counts in this file:
- ``yield_flag``: A 3626, E 365, X 211
- ``area_harvested_flag``: A 3635, E 240, X 218, I 109
- ``production_flag``: A 3639, X 226, E 204, I 133
So about 86% of yields are official figures. Estimated or external yields are
concentrated in minor fruits, vegetables, nuts and spices and in the 1960s-70s;
the staple crops (wheat, rice, seed cotton, sugar cane, chickpeas, mangoes,
potatoes, onions) are official (``A``) in every year; maize and dates have one
non-official year each. Oranges (1961-1990) and tangerines/kinnow (most years)
are mainly ``X``. Filter with ``frame[frame.yield_flag == "A"]`` to use official
figures only.
**How it was built:** ``scripts/build_pak_crops.py`` downloads FAO's QCL bulk file
for Asia (wide format with flags), keeps rows for Pakistan (area code 165) and the
elements Area harvested (5312, ha), Production (5510, t) and Yield (5412, kg/ha),
keeps the 79 items that have an area-harvested element (primary crops) and drops
FAO aggregate items (codes >= 1700, e.g. "Cereals, primary") and livestock. The
wide year columns are reshaped to one row per (crop, year). 438 crop-years for
which FAO publishes no yield were dropped: in all of them FAO reports a zero
harvested area (408, mostly 1961-1981 for vegetables and minor fruits that were not
reported separately then) or no area at all (30, "Other oil seeds" 1961-1990).
No value was filled, interpolated or recomputed. Rows are sorted by ``crop``, ``year``.
**Caveats and known biases:**
- National totals only; reporting conventions changed over time (e.g. many vegetables
start in 1980, newly reported fruits such as olives, persimmons, strawberries and
grapefruit appear only after 2016). ``Oranges`` has a gap 1991-2015.
A crop's first year in the file is where FAO starts reporting it, not when it was first grown.
- Kinnow, Pakistan's main citrus, is recorded by FAO under
``Tangerines, mandarins, clementines``; ``Mangoes, guavas and mangosteens`` mixes
three fruits; ``... n.e.c.`` items are residual groups of many minor crops.
- FAO yields are computed from production and area; for a few small crops with
rounded areas, ``production_tonnes / area_harvested_ha * 1000`` differs from
``yield_kg_per_ha`` by up to ~11%.
- FAO figures can differ from Pakistan Bureau of Statistics / Ministry of National
Food Security figures (e.g. fiscal-year vs calendar-year attribution); FAO revises
past values between releases.
- Yields span 219 to 74,252 kg/ha across crops (cereals vs. sugar cane/vegetables),
so crop identity alone explains most of the variance: a per-crop mean of
log-yield already gives R^2 ~0.94 under random 5-fold CV. Model ``log(yield)``
and evaluate with a time-based split (train on earlier years, test on later
ones) or within crops. A random row split lets the model interpolate between
neighbouring years of the same crop, which flatters the score.
- No weather, irrigation, fertiliser or price variables are included.
**Suggested tasks:**
1. Regression (beginner): predict ``log(yield_kg_per_ha)`` from ``crop``, ``year`` and
``area_harvested_ha``; train on years <= 2014, test on 2015-2024. A
one-hot + RandomForest baseline gives R^2 ~0.92 on the log scale.
2. Time series (intermediate): forecast wheat, rice or seed-cotton yield one year ahead
from lagged yields; compare against a naive "last year" forecast.
3. Clustering: build a crop x year matrix of standardised yield trends and cluster
crops by growth pattern (e.g. Green Revolution cereals vs. stagnant pulses).
4. Classification / data quality: predict whether a value is official (``yield_flag == "A"``)
from crop group, year and area, and discuss why missing-data mechanisms matter.
**Citation / attribution:**
FAO. 2025. FAOSTAT: Production: Crops and livestock products. Accessed on 29 November 2026. https://www.fao.org/faostat/en/#data/QCL. Licence: CC-BY-4.0.
Use of this data does not imply any endorsement by FAO of pakdata or of any
analysis made with it.
Citation and attribution
FAO. 2025. FAOSTAT: Production: Crops and livestock products. Accessed on 29 November 2026. https://www.fao.org/faostat/en/#data/QCL. Licence: CC-BY-4.0.
Packaged by pakdata (https://github.com/junaidaslam2006/pakData). Build script: scripts/build_pak_crops.py.
- Downloads last month
- -