Comments (4)
As described in issue 30's fix, the test code does not work for table DP03:
import censusdata as cd
tableInfo = cd.censustable("acs5", 2019, "DP03")
fullTable = cd.download("acs5", 2019, cd.censusgeo([('state', '51'), ('county', '059')]),
list(tableInfo.keys()), tabletype='subject')
ValueError: Unexpected response (URL: https://api.census.gov/data/2019/acs/acs5/subject?get=NAME,DP03_0001E,DP03_0001PE,DP03_0002E,DP03_0002PE,DP03_0003E,DP03_0003PE,DP03_0004E,DP03_0004PE,DP03_0005E,DP03_0005PE,DP03_0006E,DP03_0006PE,DP03_0007E,DP03_0007PE,DP03_0008E,DP03_0008PE,DP03_0009E,DP03_0009PE,DP03_0010E,DP03_0010PE,DP03_0011E,DP03_0011PE,DP03_0012E,DP03_0012PE,DP03_0013E,DP03_0013PE,DP03_0014E,DP03_0014PE,DP03_0015E,DP03_0015PE,DP03_0016E,DP03_0016PE,DP03_0017E,DP03_0017PE,DP03_0018E,DP03_0018PE,DP03_0019E,DP03_0019PE,DP03_0020E,DP03_0020PE,DP03_0021E,DP03_0021PE,DP03_0022E,DP03_0022PE,DP03_0023E,DP03_0023PE,DP03_0024E,DP03_0024PE,DP03_0025E&for=county:059&in=state:51): error: error: unknown variable 'DP03_0001E'
As a workaround the test code will work for table S2301. S2301_C02_008E and S2301_C02_001E can be extracted in this manner, albeit with much increased bandwidth usage due to downloading a complete table for each required administration boundary.
tableInfo = cd.censustable("acs5", 2019, "S2301")
fullTable = cd.download("acs5", 2019, cd.censusgeo([('state', '51'), ('county', '059')]),
list(tableInfo.keys()), tabletype='subject')
fullTable.T[fullTable.T.index.str.contains('_C02_008E')]
Fairfax County, Virginia: Summary level: 050, state:51> county:059 | |
---|---|
S2301_C02_008E | 82.3 |
from censusdata.
As a side note, what I find very strange about this issue is that the Census API responds with 'S2301_C02_008E' variable does not exist, but if the full table S2301 is downloaded directly from the Census Bureau, it does exist in the table.
from censusdata.
Hi,
The errors are because tabletype was not properly specified (see documentation). For subject variables (those starting in S), tabletype='subject' needs to be passed as an argument for download. Similarly, for data profile variables (those starting in DP), tabletype='profile' needs to be specified. By specifying those arguments I was able to fix both errors you mentioned. This is not related to whether the whole table is downloaded or only a part.
If there are any errors this does not address please let me know.
from censusdata.
That explains it, thank you for the correction and clarification! Somehow I missed this in the docs. Closing as resolved.
Relevant docs:
https://jtleider.github.io/censusdata/variables.html
https://jtleider.github.io/censusdata/api.html?highlight=tabletype
from censusdata.
Related Issues (20)
- Wrong Python version requirement HOT 1
- instructions HOT 1
- Indexing error HOT 3
- sf1 variables HOT 1
- Issue with TableID S0101 HOT 2
- sf1_2010_detail_variables.json missing HOT 4
- using censusdata.variable_info.censustable with full subject tables HOT 2
- 2020 redistricting data HOT 1
- Possible to add 1-year estimates for all possible years? HOT 1
- How to get census data from a specific zip code?
- CensusData request takes too long HOT 1
- Extracting FIPS and name from censusgeo index? HOT 3
- -222222222, or -666666666 Variable Values HOT 3
- Plan to include 2020 data HOT 6
- Queries for all us census tracts timing out HOT 1
- Discrepancy between API results and downloaded table from Census data.gov HOT 5
- Censusdis as a possible replacement option HOT 1
- Is rental data available? HOT 5
- Are people interested in having this work past 2019? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from censusdata.