7

I'm looking for long lists of structured demographic, economic, agricultural and/or geographic attributes of US States. For example:

<geo name="Iowa" population=3107000 cows_per_capita=1.2* etc=...>
<geo name="Connecticut" population=3597000 cows_per_capita=0.2* etc=...>

*Cows_per_capita are my estimates

A great source would be the CIA Factbook (i.e. US), but I don't know where analogous attributes can be found for individual States (also, it's only really structured by 3rd parties - example).

I feel like Wikidata would be also good source, but it seems the attribute lists are limited to qualitative data.


Formats: Appreciated formats are CSV, JSON, XML, .SQL, and even XLS/ODS files.


License: it's for non-commercial use and I'll give plenty of attribution

philshem
  • 17,647
  • 7
  • 68
  • 170
  • I found this resource for agriculture data of US States, but it's not easily machine readable http://www.ers.usda.gov/data-products/state-fact-sheets.aspx – philshem Aug 28 '15 at 05:41

2 Answers2

5

The US Census Bureau has an API for most of its datasets, which will allow you to retrieve state-based data in a structured form.

You just have to request an API key. They provide examples for each of the datasets - a small and basic dataset like the Population Estimates might be a good place to start. This example shows you what you would get if you select all states and the population and date variables from the 2013 dataset (copy and paste the entire link to get it to work):

http://api.census.gov/data/2013/pep/natstprc?get=STNAME,POP&for=state:*&DATE=6

It's plain text data - the format resembles the list type that's used in Python. I don't know if XML is an option or not.

[["STNAME","POP","DATE","state"],
["Alabama","4833722","6","01"],
["Alaska","735132","6","02"],
["Arizona","6626624","6","04"],
....
["Wisconsin","5742713","6","55"],
["Wyoming","582658","6","56"],
["Puerto Rico Commonwealth","3615086","6","72"]]

If you want a wide variety of variables, but don't want to query tons of different tables, you can try pulling from the demographic profile tables from the 2010 Census (table DP-1) and the American Community Survey (tables DP02 through DP05).

philshem
  • 17,647
  • 7
  • 68
  • 170
fdonnelly
  • 1,130
  • 6
  • 10
4

country.json should help you out on the country level:
https://github.com/samayo/country.json

albert
  • 11,885
  • 4
  • 30
  • 57