Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Read Census Data via Python
import json,urllib,cairoplot
url='http://thedataweb.rm.census.gov/data/2010/sf1?key={YOUR_KEY_HERE}&get=P0010001,NAME&for=county:025,017,061,165&in=state:39'
result=json.load(urllib.urlopen(url))
graphData=[]
graphLabels=[]
for row in result:
print row[1],row[0],'\n'
if(result.index(row)>0):
graphData.append(int(row[0]))
graphLabels.append(row[1])
cairoplot.vertical_bar_plot('C:\\temp\\test.png',graphData,600,450,grid=True,x_labels=graphLabels)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment