Closed jvtcl closed 11 months ago
To follow on, it seems the request failure is tied to generating queries for block groups.
This call successfully returns results (also when using a wildcard for tract ID):
get_census(
dataset="acs/acs5",
variables=['B01001_001E', 'B09019_026E', 'B27010_001E', 'B25001_001E', 'B25003_001E'],
params={'for': 'tract:003700', 'in': 'state:47+county:093'},
year=2019,
return_geoid=True,
)
But this one fails with the same error as above:
get_census(
dataset="acs/acs5",
variables=['B01001_001E', 'B09019_026E', 'B27010_001E', 'B25001_001E', 'B25003_001E'],
params={'for': 'block+group:1', 'in': 'state:47+county:093+tract:003700'},
year=2019,
)
Seems I got this sorted: block group
should be written with a space and not a +
separator. The separator is added under the hood here.
The following now works:
get_census(
dataset="acs/acs5",
variables=['B01001_001E', 'B09019_026E', 'B27010_001E', 'B25001_001E', 'B25003_001E'],
params={'for': 'block group:1', 'in': 'state:47+county:093+tract:003700'},
year=2019,
)
I'm running into some trouble executing an ACS request with
data.get_census()
and user-specifiedparams
:This results in a failed request:
However, I can generate a URL containing the same variables and parameters, and the request is successful: https://api.census.gov/data/2019/acs/acs5?get=B01001_001E,B09019_026E,B27010_001E,B25001_001E,B25003_001E&for=block+group:*&in=state:47+county:093+tract:*