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

How to get population by zip code? #76

Open
ratchetwrench opened this issue May 10, 2019 · 8 comments
Open

How to get population by zip code? #76

ratchetwrench opened this issue May 10, 2019 · 8 comments

Comments

@ratchetwrench
Copy link

I am trying to query the population by zip code, but I am not sure how to approach it with this library.

@jeancochrane
Copy link
Contributor

Have you tried the acs5.zipcode method? The variable for total population is B01003_001E, so you should be able to make calls like this (with zip code 60608):

>>> c.acs5.zipcode('B01003_001E', 60608)
[{'B01003_001E': 78877.0, 'zip code tabulation area': '60608'}]

@UGuntupalli
Copy link

@jeancochrane :
I am looking to do the same thing, however for my application, I need ACS1, do you know if there is way to get this data for acs1 ? I don't see a zipcode method for acs1, so I am looking at alternatives.

@jeancochrane
Copy link
Contributor

@UGuntupalli I don't think zip code tabulation areas are an available geography for ACS1, see: https://www.census.gov/programs-surveys/geography/guidance/geo-areas/zctas.html#ti129385160 My understanding is that ACS1 doesn't have a large enough sample size to accurately reflect that level of geographic resolution, but I'm not an expert. Here's a comparison of different yearly estimates: https://www.census.gov/programs-surveys/acs/guidance/estimates.html

@UGuntupalli
Copy link

@jeancochrane ,
Thank you for pointing me to that resource. For the problem I am trying to solve, a reasonable estimate and an approximation of level of change is sufficient. I am not really bothered about the precision, so if there is a way to do it with ACS1 that would be great. Thank you for clarifying that zip code tabulation is not available. I opened a new issue to see if county level query can be run. (#91)

@jeancochrane
Copy link
Contributor

As an alternative, you might try https://github.com/datamade/census_area, which extends this library to let you query by arbitrary geographies (you could use a GeoJSON of the zip codes you care about). The precision of the estimate will probably be misleading but if you don't care so much about that it might work for you.

@VincentLa
Copy link

Hm, I seem to be getting an error now using c.acs5.zipcode, when I run the above I get:

c.acs5.zipcode('B01003_001E', 60608)
CensusException: error: ambiguous geography "zip code tabulation area:60608". You must either specify a wildcard or full qualify it with state

Not sure what this means?

@MikeLeahy24
Copy link

@VincentLa While I couldn't get it to work as it's meant to. I have been able to pull the needed data by passing
zcta = '*'
into the function. It will return a list of dictionaries (one for each zip code). Not ideal, but you can loop through it and pull the data for your zip code of interest

@nish-08
Copy link

nish-08 commented Jan 9, 2023

@UGuntupalli , were you able to figure out anyway to get ACS1 estimates?

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

6 participants