census icon indicating copy to clipboard operation
census copied to clipboard

census.acs5_state does not work for years from 2010-2015

Open xzhou56 opened this issue 5 years ago • 6 comments

To whom it may concern:

I am trying to use census.acs5_state and census.acs5_state_place. They only worked well for the year 2009 and 2016, but not working for years from 2010 to 2015. Is there anything wrong with these years?

Thanks.

xzhou56 avatar Mar 05 '19 19:03 xzhou56

Could you post your codes and error message?

semcogli avatar Mar 05 '19 20:03 semcogli

Sure. c.acs5.state('B01001_004E', '*',year=2015) if changing the year to 2009 or 2016, it works.

The same issue happened to state_place: c.acs5.state_place(tuple(varlist),'','',year=2010)

Error message: CensusException:

Error report

HTTP Status 404 - /data/2010/acs5

<HR size="1" noshade="noshade">

type Status report

message /data/2010/acs5

description The requested resource is not available.

<HR size="1" noshade="noshade">

xzhou56 avatar Mar 06 '19 15:03 xzhou56

it works for me. Requests for years from 10 to 15 returned data as normal. Not sure what happens there. one thing you can try is to reinstall your census library and see if that helps. Best regards.

c.acs5.state('B01001_004E', '*',year=2015) [{'B01001_004E': 156380.0, 'state': '01'}, {'B01001_004E': 26276.0, 'state': '02'}, {'B01001_004E': 231249.0, 'state': '04'}, {'B01001_004E': 103613.0, 'state': '05'}, {'B01001_004E': 1295030.0, 'state': '06'},

semcogli avatar Mar 06 '19 15:03 semcogli

Thanks. I uninstalled and re-installed, but it still didn't work for me.

So I went back to census API document, we found that, the api call for 2009 data is a little different from all other years. In 2009: api.census.gov/data/2009/acs5? But in other years: https://api.census.gov/data/2011/acs/acs5?

I don't know if this affects your library but wanna share here just in case someone else has a similar issue like me.

xzhou56 avatar Mar 06 '19 17:03 xzhou56

the issue you mentioned has been taken cared of, I believe, https://github.com/datamade/census/blob/master/census/core.py line 278, you can see the endpoint url switches depends on the years you are querying. you can check your local file and see if it is correct.

semcogli avatar Mar 06 '19 18:03 semcogli

I upgraded to the latest version and this was fixed for me.

palewire avatar Mar 12 '19 22:03 palewire