GitHunt
IT

itz-Mayank/Agriculture_Analytics

India's agricultural sector is vital for the economy, but the management of agricultural data remains a challenge due to its complexity, fragmented nature, and lack of easy access. Various stakeholders such as farmers, policymakers, and researchers face difficulties in accessing, analyzing, and making informed decisions based on agricultural data.

Agriculture_Analytics

India's agricultural sector is vital for the economy, but the management of agricultural data remains a challenge due to its complexity, fragmented nature, and lack of easy access. Various stakeholders such as farmers, policymakers, and researchers face difficulties in accessing, analyzing, and making informed decisions based on agricultural data.

๐Ÿšœ AgriData Explorer: Analyzing Indian Agriculture with Power BI

Welcome to the AgriData Explorer โ€” a comprehensive data analytics and visualization project designed to analyze the agricultural landscape of India using Python, SQL, and Power BI.


๐Ÿ“Œ Project Objective

The primary goal of this project is to understand and visualize agricultural trends across Indian states and districts. We analyze key metrics like crop area, production, and yield over time and across regions, providing insightful trends and actionable recommendations.


๐Ÿงพ Dataset Description

The dataset includes historical agricultural statistics of various crops across Indian states and districts for multiple years.

Key Fields Include:

  • Year, State_Name, Dist_Name
  • Crop-specific columns like:
    • RICE_AREA, RICE_PRODUCTION, RICE_YIELD
    • WHEAT_AREA, MAIZE_YIELD, COTTON_PRODUCTION, etc.

Data Source:

Data was preprocessed using Python (Pandas) and stored in a MySQL database. It was then connected to Power BI for visualization.


๐Ÿ”„ Project Workflow

1. Data Preprocessing (Python)

  • Loaded the dataset using pandas
  • Cleaned and renamed columns for consistency
  • Uploaded the cleaned dataset into MySQL using SQLAlchemy

2. SQL Queries

Used SQL for data retrieval and analysis such as:

  • Aggregating total production/yield
  • Ranking states/districts
  • Performing 5-year comparisons

3. Power BI Visualizations

  • Connected to MySQL as a data source
  • Created DAX measures for dynamic analysis
  • Designed visualizations to explore year-wise and state-wise trends

๐Ÿ“Š Visualizations and Insights

Included Charts:

  • Line Charts โ€“ Year-wise yield/production trends
  • Bar Charts โ€“ Top crops/states/districts
  • Donut Charts โ€“ Share of production
  • KPI Cards โ€“ Dynamic indicators using slicers
  • Heatmaps and Tables โ€“ Detailed breakdowns

Interactive Features:

  • Slicers for Crop, Year, State, and District
  • Dynamic DAX measures based on selected crop

๐Ÿ’ก Key Insights

  • Rice production is highly concentrated in Eastern and Southern states.
  • Punjab and Rajasthan show highest wheat yields.
  • Maize shows a strong correlation between area and yield.
  • Certain districts show stagnant productivity and are candidates for policy intervention.

๐Ÿ“ˆ DAX Measures

Sample: Crop Yield (Dynamic)

CROP_YIELD = 
SWITCH(
    SELECTEDVALUE(CropTable[Crop]),
    "RICE", DIVIDE(SUM(agri_data[RICE_PRODUCTION]), SUM(agri_data[RICE_AREA])),
    "WHEAT", DIVIDE(SUM(agri_data[WHEAT_PRODUCTION]), SUM(agri_data[WHEAT_AREA])),
    "MAIZE", DIVIDE(SUM(agri_data[MAIZE_PRODUCTION]), SUM(agri_data[MAIZE_AREA])),
    ...
)

๐Ÿงช Evaluation Metrics

Metric Description
๐Ÿ“Š Accuracy Visuals clearly represent underlying data
โšก Performance Fast loading and filtering
๐ŸŽฏ Engagement Slicers and interactivity
โœ… Completeness All important metrics are included
๐Ÿ˜Š User Feedback Easy to interpret and explore

๐Ÿ› ๏ธ Tech Stack

  • Python (Pandas, SQLAlchemy)
  • MySQL (Data storage & SQL analysis)
  • Power BI (Dashboards, DAX measures)
  • DAX (Calculated metrics and dynamic filters)

๐Ÿ“‚ Repository Contents

File Description
agriculture.pbit Power BI template with all visuals
README.md GitHub documentation
AgriData_Explorer_Documentation.docx Detailed report
sql_queries.sql (optional) SQL used for visualizations
data_cleaning.py (optional) Python preprocessing script

๐Ÿš€ How to Use This Project

  1. Clone or download the repository
  2. Open agriculture.pbit in Power BI Desktop
  3. Update MySQL server credentials when prompted
  4. Refresh and explore the interactive dashboard

๐Ÿ™Œ Author & Acknowledgement

Created by: Mayank Meghwal
For academic and analytical purposes. Open to improvements and community contributions.


๐Ÿ–ผ๏ธ Screenshots

Power BI Visualization

Caption
Caption


๐Ÿ“ License

This project is open for learning and analysis. Not for commercial use without permission.