Open ajkluber opened 4 years ago
I can confirm this bug report. Here is another example:
cxn = cenpy.tiger.TigerConnection('PUMA_TAD_TAZ_UGA_ZCTA')
az_pumas = cxn.query(layer='(ESRILayer) Public Use Microdata Areas', where='STATE = 04')
Output
TypeError: list indices must be integers or slices, not Index
The solution proposed by @ajkluber (to replace .index
with .name
) at line 269 works on my use case. Not sure if this is the general solution though.
Workaround for the time being:
cxn = cenpy.tiger.TigerConnection('PUMA_TAD_TAZ_UGA_ZCTA')
layer = '(ESRILayer) Public Use Microdata Areas'
index = [f.__repr__() for f in cxn.layers].index(layer)
az_pumas = cxn.layers[index].query(where='STATE = 04')
Thanks for writing an awesome package! I have been getting to know it better the last couple weeks and think it will be very useful for my own projects. At the moment, I want to use your
TigerConnection
to get census tract GeoDataFrame using longitude and latitude following this example. In the process I think I found a little bug.In particular, passing a string for
layer
to.query
onTigerConnection
gives a TypeError. Here is a short code snippet, with a more complete example below.I think this can be fixed by changing
.index
in this call to_fuzzy_match
to.name
, which is how other calls to_fuzzy_match
use the return value. https://github.com/cenpy-devs/cenpy/blob/3d76a09de02d7fa9efff0c03f58af3429e2ce15a/cenpy/tiger.py#L267-L269From what I tell, this doesn't impact any of the main features of the higher up products because
.query
is never called onTigerConnection
, only onESRILayer
. Maybe this is why it hasn't shown up before.Code to reproduce error
Gives the following output...