This data product provided by the USDA contains statistics on four main feed grains - corn, grain sorghum, barley, and oats - as well as foreign coarse grains such as rye, millet, hay, and related items. This includes data published in the monthly Feed Outlook and previously annual Feed Yearbook. Data are monthly, quarterly, and/or annual depending upon the data series.
Latest data may be preliminary or projected. Missing values indicate unreported values, discontinued series, or not yet released data. It is available in a bulk download from here.
Example in Python
import pandas as pd df = pd.read_excel('Feed Grains Yearbook Tables-Recent.xls' , sheet_name='FGYearbookTable01' , skiprows=[0, 1, 38, 39, 40, 41] , names=['commodity', 'year', 'planted', 'harvested', 'production', 'yield', 'price', 'loan_rate'] , header=None) df.dropna(how='all', inplace=True) df.commodity.fillna(method='ffill', inplace=True)
Example in R
This API provides access to data from the Census of Agriculture as well as national, state, and county level surveys. Data is queried through requesting commodities encapsulated in the sectors of Crops, Animals & Products, Economics, Demographics, and Environmental. The commodity statistics are aggregated for standard census geographies, agricultural statistics districts, and watershed boundaries over annual, seasonal, monthly, weekly, and daily time periods.
Full Documentation, a Data Dictionary, and API Registration can be found here. Example in Python
import requests import pandas as pd key = 'your_api_key' # Observations for corn in Virginia in 2010 url = 'http://quickstats.nass.usda.gov/api/api_GET/?key={}&\ commodity_desc=CORN&year__GE=2010&state_alpha=VA' response = requests.get(url.format(key)) data = response.json() df = pd.DataFrame(data['data'])
library(jsonlite) key <- "your_api_key" # Observations for corn in Virginia in 2010 url <- paste("http://quickstats.nass.usda.gov/api/api_GET/?key=" , key , "&commodity_desc=CORN&year__GE=2010&state_alpha=VA" , sep = "") data <- fromJSON(url) df <- data.frame(data)