Last active
January 30, 2016 01:42
-
-
Save linanqiu/fdac66eea6f9513eac8b to your computer and use it in GitHub Desktop.
Census Population Query Usage
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 census | |
# say we want to get the number of females asians between 40 and 45 in Ohio, presented by county | |
# instead of | |
census.query( | |
'name'=['PCT0120147', 'PCT0120148', 'PCT0120149', 'PCT0120150', 'PCT0120151'] | |
'geo': {'state': 'OH', 'county': '*'}) | |
# oh and the table will be retuned separately for 41 year olds, 42 year olds etc. | |
# we have | |
dataframe1 = census.Population( | |
'geo'={'state': 'OH', 'county': '*'}, | |
'filter'={'sex': 'female', 'age': [40, 45], 'race': 'asian'}) | |
# data will be returned in a single table | |
# another query! | |
dataframe2 = census.Population( | |
'geo'={'state': 'OH', 'county': '*'}, | |
'filter'={'sex': 'female', 'age': [18], 'race': ['white', 'black'], 'hispanic-latino-origin': True}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment