census icon indicating copy to clipboard operation
census copied to clipboard

Unhashable type dict

Open anthonymoser opened this issue 2 years ago • 2 comments

When I try to use any of the demos from the census package or the ward walkthrough, for example
test = c.acs5.state(('NAME', 'B25034_010E'), states.MD.fips, year=2010)

I get TypeError: unhashable type: 'dict'

coming from this line: return super(ACSClient, self).get(*args, **kwargs)

https://github.com/datamade/census/blob/dd4f171aacc007272071a213504fb89aa3c17c80/census/core.py#L313

I tried to test to see if it was my VPN causing problems, or my python version, etc. But the issue has remained. Could be something weird about my environment? But if so I don't know what. Thought I should flag in case something changed about the data structure returned by the census api. I was able to get some block level responses, but not tract.

anthonymoser avatar Mar 07 '22 05:03 anthonymoser

hi @anthonymoser, can't reproduce.

from census import Census
from us import states

c = Census("YOUR_API_KEY")

foo = c.acs5.get(('NAME', 'B25034_010E'),
                 {'for': 'state:{}'.format(states.MD.fips)})

    
test = c.acs5.state(('NAME', 'B25034_010E'), states.MD.fips)

test = c.acs5.state(('NAME', 'B25034_010E'), states.MD.fips, year=2010)

print(test)

this complete code example (with a correct API key) works for me. will it run for you?

fgregg avatar Mar 10 '22 17:03 fgregg

Hi, @anthonymoser – were you using the core Census client, or the extended Census client from the census_area package? If the latter, there was a bug in our implementation of the lru_cache, which was patched in https://github.com/datamade/census_area/pull/13. Want to install the latest version and give your code another try?

hancush avatar Apr 25 '22 19:04 hancush