dhyann2815/india-crop-yield-prediction
收藏Hugging Face2026-04-27 更新2026-05-03 收录
下载链接:
https://hf-mirror.com/datasets/dhyann2815/india-crop-yield-prediction
下载链接
链接失效反馈官方服务:
资源简介:
---
license: apache-2.0
task_categories:
- tabular-regression
language:
- en
tags:
- agriculture
- india
- crop-yield
- prediction
- regression
- time-series
size_categories:
- 10K<n<100K
---
# 🇮🇳 India Crop Yield Prediction Dataset (2000–2026)
A comprehensive dataset for building **crop yield prediction models** for Indian agriculture, covering **27 years** (2000–2026), **31 states/UTs**, and **62 crop types**.
## Dataset Summary
| Metric | Value |
|--------|-------|
| **Total Records** | 21,750 |
| **Year Range** | 2000 – 2026 |
| **States/UTs** | 31 |
| **Crop Types** | 62 |
| **Train Split** | 17,400 (80%) |
| **Test Split** | 4,350 (20%) |
| **Missing Values** | 0 |
## Features
| Column | Type | Description |
|--------|------|-------------|
| `Year` | int | Crop year (2000–2026) |
| `State` | string | Indian state or Union Territory |
| `Crop` | string | Crop name (e.g., Rice, Wheat, Sugarcane) |
| `Season` | string | Growing season (Kharif, Rabi, Whole Year, Summer, Autumn, Winter) |
| `Area` | float | Area under cultivation (hectares) |
| `Production` | float | Total production (metric tons) |
| `Annual_Rainfall` | float | Annual rainfall (mm) |
| `Fertilizer` | float | Fertilizer usage (tonnes) |
| `Pesticide` | float | Pesticide usage (tonnes) |
| `Yield` | float | **Target variable** — Crop yield (metric tons per hectare) |
## Input/Output for Prediction
**Input features:** `Year`, `State`, `Crop` (+ optional: `Season`, `Area`, `Annual_Rainfall`, `Fertilizer`, `Pesticide`)
**Target:** `Yield` (metric tons per hectare)
## States Covered
Andhra Pradesh, Arunachal Pradesh, Assam, Bihar, Chhattisgarh, Delhi, Goa, Gujarat, Haryana, Himachal Pradesh, Jammu and Kashmir, Jharkhand, Karnataka, Kerala, Madhya Pradesh, Maharashtra, Manipur, Meghalaya, Mizoram, Nagaland, Odisha, Puducherry, Punjab, Rajasthan, Sikkim, Tamil Nadu, Telangana, Tripura, Uttar Pradesh, Uttarakhand, West Bengal
## Major Crops
**Cereals:** Rice, Wheat, Maize, Bajra, Jowar, Ragi, Barley, Small Millets
**Pulses:** Arhar/Tur, Gram, Moong, Urad, Masoor, Lentil
**Oilseeds:** Groundnut, Mustard, Soyabean, Sunflower, Sesamum, Castor seed, Linseed
**Cash Crops:** Sugarcane, Cotton, Jute, Tobacco
**Fruits & Vegetables:** Potato, Onion, Banana, Mango, Tomato, and more
## Season Distribution
| Season | Records | Percentage |
|--------|---------|-----------|
| Kharif | 10,879 | 50.0% |
| Rabi | 5,258 | 24.2% |
| Whole Year | 4,911 | 22.6% |
| Autumn | 476 | 2.2% |
| Summer | 155 | 0.7% |
| Winter | 71 | 0.3% |
## Quick Start
```python
from datasets import load_dataset
ds = load_dataset("dhyann2815/india-crop-yield-prediction")
train = ds["train"]
test = ds["test"]
# Example: Filter for Rice in Punjab
import pandas as pd
df = train.to_pandas()
rice_punjab = df[(df["Crop"] == "Rice") & (df["State"] == "Punjab")]
print(rice_punjab[["Year", "Yield"]].sort_values("Year"))
```
## Building a Prediction Model
```python
from datasets import load_dataset
from sklearn.ensemble import GradientBoostingRegressor
from sklearn.preprocessing import LabelEncoder
import pandas as pd
ds = load_dataset("dhyann2815/india-crop-yield-prediction")
train_df = ds["train"].to_pandas()
test_df = ds["test"].to_pandas()
# Encode categoricals
le_state = LabelEncoder().fit(pd.concat([train_df["State"], test_df["State"]]))
le_crop = LabelEncoder().fit(pd.concat([train_df["Crop"], test_df["Crop"]]))
le_season = LabelEncoder().fit(pd.concat([train_df["Season"], test_df["Season"]]))
for df in [train_df, test_df]:
df["State_enc"] = le_state.transform(df["State"])
df["Crop_enc"] = le_crop.transform(df["Crop"])
df["Season_enc"] = le_season.transform(df["Season"])
features = ["Year", "State_enc", "Crop_enc", "Season_enc", "Annual_Rainfall", "Fertilizer", "Pesticide"]
model = GradientBoostingRegressor(n_estimators=200, max_depth=6, random_state=42)
model.fit(train_df[features], train_df["Yield"])
score = model.score(test_df[features], test_df["Yield"])
print(f"R² Score: {score:.4f}")
```
## Data Sources & Methodology
- **2000–2020:** Based on official Indian agricultural statistics (via [Kaggle source dataset](https://huggingface.co/datasets/jason1966/akshatgupta7_crop-yield-in-indian-states-dataset)) which compiles data from the Directorate of Economics and Statistics, Ministry of Agriculture, Government of India.
- **2021–2026:** Extended using state-crop-specific linear trend extrapolation from historical patterns, with realistic noise modeling for rainfall variability, fertilizer/pesticide growth trends, and natural yield fluctuations.
- **Gap-filling:** Missing state-crop combinations for 20 major agricultural states were filled using crop-specific yield ranges and state-level rainfall parameters from Indian Meteorological Department norms.
## License
Apache 2.0
提供机构:
dhyann2815



