Crop Yield Prediction
Build a yield-prediction model on the Kaggle pre-joined yield + rainfall + pesticides + temperature panel — this is the canonical Kaggle use case for this dataset.
Crop Yield Prediction
Python / R • Step 3
Build a yield-prediction model on the Kaggle pre-joined yield + rainfall + pesticides + temperature panel — this is the canonical Kaggle use case for this dataset.
Learning Objectives
- →Combine categorical (Area, Item) and numeric (rainfall, pesticides, temp) features
- →Train & evaluate a Random Forest regressor
- →Interpret feature importance"
Dataset
View on KaggleFAO yield joined with rainfall, pesticides, and temperature per country/crop/year.
*bleep* Load the dataset in the browser terminal:
from pyodide.http import open_url
import pandas as pd
df = pd.read_csv(open_url("/datasets/yield_df.csv"))
print(df.shape)
print(df.columns.tolist()) Running locally? The file inside the Kaggle download is already named yield_df.csv — drop it into the notebook's working directory and the code above runs unchanged (swap open_url(...) for "yield_df.csv").
Dataset Columns
AreaItemYearhg/ha_yieldaverage_rain_fall_mm_per_yearpesticides_tonnesavg_tempCode Language
- Write your solution in the Try It Yourself editor below — matplotlib/seaborn figures and pandas tables render inline.
- Stuck? Expand a section and click ↑ Send to editor to stack its snippet into the editor, notebook-style.
- Hit ▶ Run (or ⌘↵) — once your output matches the expected result, the step is marked solved.
- Use ↺ Reset to restore the starter code at any time.
Try It Yourself
R²: MAE:
Cross-verse learning
Bleepx skills build on each other. Continue your learning path across Query, Lab, and Cloud.