Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Creating Queries with More than one Geography Type #6

Closed
PFurst2000 opened this issue Sep 30, 2019 · 1 comment
Closed

Creating Queries with More than one Geography Type #6

PFurst2000 opened this issue Sep 30, 2019 · 1 comment

Comments

@PFurst2000
Copy link

Hi Julien,
Could you provide an example of how one would select both a particular county and a census tract? For example, run a query to collect data for Richmond County, NY (FIPS 36085) and Census Tract 3 in Richmond County (FIPS (36085000300)? Additionally, how would run a query for all counties in two separate states?
In the example below I tried to select all counties from two states but didn't have any luck.

import pandas as pd
import censusdata
pd.set_option('display.expand_frame_repr', False)
pd.set_option('display.precision', 2)
cookbg = censusdata.download('acs5', 2015,
censusdata.censusgeo([('state', '36', '33'), ('county', '*')]),

@jtleider
Copy link
Owner

jtleider commented Oct 6, 2019

Hi,

You can concatenate the separate queries:
import pandas as pd
import censusdata
pd.concat([censusdata.download('acs5', 2015, censusdata.censusgeo([('state', '06')]), ['B01001_001E']),
censusdata.download('acs5', 2015, censusdata.censusgeo([('state', '36')]), ['B01001_001E'])])

This would apply to any situation where you were trying to select multiple geographies of different types.

Best,
Julien

@jtleider jtleider closed this as completed Oct 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants