jtleider / censusdata

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

Downloading places table/data #3

Closed tjk911 closed 5 years ago

tjk911 commented 5 years ago

I'm trying to download census data specific to places and I'm getting an unsupported hierarchy error.

It looks like, from the documentation, that the hierarchy is states>places and this works:

census_places = censusdata.geographies(censusdata.censusgeo([('state', '36'), ('place', '*')]), 'acs5', 2015)

But this does not

censusdata.download('acs5', 2016, censusdata.censusgeo([('state', '36'), ('places', '01011')]),["B01002_001E", "B01002_002E", "B01002_003E", "B01002A_001E", "B01002A_002E", "B01002A_003E", "B01002B_001E", "B01002B_002E", "B01002B_003E", "B01002C_001E", "B01002C_002E", "B01002C_003E", "B01002D_001E", "B01002D_002E", "B01002D_003E", "B01002E_001E", "B01002E_002E", "B01002E_003E", "B01002F_001E", "B01002F_002E", "B01002F_003E"])

I'm not entirely sure where I'm going wrong. Any suggestions?

jtleider commented 5 years ago

You have a typo in your code, 'places' should be 'place':

censusdata.download('acs5', 2016, censusdata.censusgeo([('state', '36'), ('place', '01011')]),["B01002_001E", "B01002_002E", "B01002_003E", "B01002A_001E", "B01002A_002E", "B01002A_003E", "B01002B_001E", "B01002B_002E", "B01002B_003E", "B01002C_001E", "B01002C_002E", "B01002C_003E", "B01002D_001E", "B01002D_002E", "B01002D_003E", "B01002E_001E", "B01002E_002E", "B01002E_003E", "B01002F_001E", "B01002F_002E", "B01002F_003E"])

Best, Julien

tjk911 commented 5 years ago

Dammit. Thanks Julien, that was a very silly mistake of mine. Can't believe I spent so much time trying to figure out what was wrong and it was a stupid typo.