Data Science in Indian Agriculture Market


Despite India having vast areas of fertile/cultivatable land combined with the presence of perennial and seasonal rivers giving it the most favorable condition to grow crops, still, our country lacks the resources to uplift the condition of its farmers.

One of the major reasons behind the plightful condition of the Indian farmers is the lack of information services to provide basic insights about 1) the best market rate for their produce 2) location of the nearest wholesale market 3) Forecast for rainfall 4) logistics support.

“The average household living in metro earns and saves twice as much as an average household in a rural area”
Image Credits: Live Mint

This imbalance in the income has caused major migration into cities, thereby deserting villages and creating unsustainable over-crowded cities.


How Data Science Impetuses Indian Agro Market

Due to the presence of Open Government data (OGD) Platform India, getting valuable agriculture market data has become easier than ever before. The daily market prices get updated and can be accessed through APIs provided by Govt of India which is contributed by the Ministry of Agriculture and Farmers Welfare and Department of Agriculture, Cooperation and Farmers Welfare.

In this article, I will be discussing only on the use of providing information to the farmers regarding the best prices they may get for their produce in their state.

response = requests.get(url,param)
url = https://api.data.gov.in/resource/9ef84268-d588-465a- a308-a864a43d0070
param ={‘api-key’:’579b44db66ec23bdd00841d687b4**’,‘format’:’json’,‘limit’:5000}

The code helps in connecting the services and returns the daily market selling price of agricultural commodities for different markets (Mandis) across India.The output will be in JSON format and can be used to provide useful insights to farmers.

The code helps in connecting with the service and returns the daily market selling price of agricultural commodities for different markets (Mandis) across India.The output will be in JSON format and can be used to provide insights to farmers.


A simple function is created that helps in evaluating the best market for a particular produce (tomato) in the state of Karnataka.

The same function will provide the best market(Mandi) for a farmer in the state of Uttar Pradesh trying to sell Tomatoes

This can be considered as a starting point for deep meaningful insights that may be implemented to make life of Indian farmers better.