Created
July 16, 2012 14:13
-
-
Save AndrewTheTM/3122936 to your computer and use it in GitHub Desktop.
Read Census Data via Python
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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