Issue on page /docs/d_access_census.html
I am having a problem using "c.acs5.state_county_tract()." I have not had issues using this previously, but just recently I cannot run it. I keep getting this error: "KeyError: 'long'". Is this an issue for other users?
Can you send a snippet of code so we can see how you are using it?
Yes of course. Here is the code:
FL_census = c.acs5.state_county_tract(fields = ('NAME', 'B03001_002E', 'B01003_001E', 'B07012_002E', 'C17002_002E', 'C17002_003E', 'B02001_002E'), state_fips = states.FL.fips, county_fips = "*", tract = "*", year = 2019)
I hav also included a screenshot of the error.
Hmm... I thought i knew what the problem is. But now I am not sure. Can you try running it with a limited number of fields eg 'NAME', 'B03001_002E',, and see if there is a problem with one of the field codes?
Are you able to make queries for other times/places fields? For instance try:
va_census = c.acs5.state_county_tract(fields = ('NAME', 'C17002_001E', 'C17002_002E', 'C17002_003E', 'B01003_001E'),
state_fips = states.VA.fips,
county_fips = "*",
tract = "*",
year = 2017)
Let me know.
I've tried both limiting the fields as well as trying a different state. I have also tried using a different year of data (2017 versus 2019), but the error is the same every time.
Hmm.. is it possible your API key expired? Try signing up for a new one https://api.census.gov/data/key_signup.html
On Wed, May 29, 2024 at 10:57 AM Olivia Sablan @.***> wrote:
I've tried both limiting the fields as well as trying a different state. I have also tried using a different year of data (2017 versus 2019), but the error is the same every time.
— Reply to this email directly, view it on GitHub https://github.com/mmann1123/pyGIS/issues/66#issuecomment-2137624025, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABHR6VELMFVNR3VOSAP7WZTZEXUEHAVCNFSM6AAAAABINZU522VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMZXGYZDIMBSGU . You are receiving this because you commented.Message ID: @.***>
I thought that may be the case as well, but no luck with a new API. Maybe it's a problem with my conda environment? I was thinking there may be a universal issue with this code, but if it just a problem on my end then I will try digging a little more. Thank you!
You might open an issue with the census module folks.
Also just to double check, are you putting quotes around your API key eg "woeinv832fiuf97wgefbv" ?
On Wed, May 29, 2024 at 11:33 AM Olivia Sablan @.***> wrote:
I thought that may be the case as well, but no luck with a new API. Maybe it's a problem with my conda environment? I was thinking there may be a universal issue with this code, but if it just a problem on my end then I will try digging a little more. Thank you!
— Reply to this email directly, view it on GitHub https://github.com/mmann1123/pyGIS/issues/66#issuecomment-2137704796, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABHR6VD46ZCNUGFIPJSNRE3ZEXYL5AVCNFSM6AAAAABINZU522VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMZXG4YDINZZGY . You are receiving this because you commented.Message ID: @.***>
Yes I am! I am not sure why this is happening all of the sudden since I have been using this same code with no changes for months now. I may have installed a new package in the same environment which caused problems with the census package.
Update: I just attempted to use my code again (with no changes) and it is now working... not sure what was going on with the census but it must have been resolved. Thank you for your help!