census
census copied to clipboard
API returns value of -666666666
Some calls to acs5.state_county_tract()
return the value -666666666
. This seems like a semantically significant value, but I can't find documentation on what it means.
For a reproducible example, this call returns the value in question:
>>> c = Census(os.environ['CENSUS_API_KEY'], year=2016)
>>> c.acs5.state_county_tract('B19081_001E', 42, 101, '989100')
[{'B19081_001E': -666666666.0, 'state': '42', 'county': '101', 'tract': '989100'}]
Any thoughts on what this response means, and how I should handle it? So far I've just been converting them to nulls.
Here are those definitions:
https://www.census.gov/data/developers/data-sets/acs-1year/notes-on-acs-estimate-and-annotation-values.html
Exactly what I was looking for, thanks @loganpowell!
How do you think the library should handle this response @fgregg? I'm happy to give a PR a shot if you can provide guidance.
I think it would be good to configure the library to do two things based on a user setting.
- cast these to null, and emit a warning
- raise an exception
Not sure what the default should be? Thoughts?
My reading of the docs is that this value means one of either:
- No data
- Not enough data to make an estimate
- Ratio of medians could not be calculated (?)
I don't feel confident I understand what's going on with 3), but 1) and 2) both indicate to me that casting to null and raising a warning would be a good default, since null is a common interpretation of "no data".
casting to null and raising a warning is probably a bit more backwards compatible too
not sure if the behaviour should be set on initialization of census class or on the get data methods
probably on the methods.