jtleider / censusdata

Download data from Census API
MIT License
139 stars 29 forks source link

using censusdata.variable_info.censustable with full subject tables #32

Closed josephholler closed 3 years ago

josephholler commented 3 years ago

I am attempting to search for variable information on an ACS 5-year subject table with this code:

censusdata.variable_info.censustable('acs5',2018,'S1810')

which I thought should work, since you can use the census API to query this group in full: https://api.census.gov/data/2018/acs/acs5/subject?get=group(S1810)&for=county:*

I found that adding sub-table information will work, e.g.

censusdata.variable_info.censustable('acs5',2018,'S1810_C01')

Meanwhile, a similar API Query does not work: https://api.census.gov/data/2018/acs/acs5/subject?get=group(S1810_C01)&for=county:*

I wonder if a new feature could use the first query to find all the S1810 variables?

steventrev commented 3 years ago

Hiya - my simple PR should address this.

Just for some background, the censusdata.variable_info.censustable() function does not make a Census API call, but instead looks through this package's variables/*.json files. I'm under the impression that these are mirrored copies of the API output to reduce API calls.

jtleider commented 3 years ago

That is correct, censustable() does not rely on an API call. The requested feature is added in version 1.15. Thank you for the suggestion.