BUG: Float64Index getitem raises error with tuple-like values · Issue #13509 · pandas-dev/pandas (original) (raw)

So when you have a Series with the combination of a Float64Index and tuple values, getitem/[] gives an error:

In [46]: s = pd.Series([1,2,3], index=[0.0,0.1,0.2])

In [47]: s[0.0]
Out[47]: 1

In [48]: s = pd.Series([(1,1),(2,2),(3,3)], index=[0.0,0.1,0.2])

In [49]: s[0.0]
...
TypeError: len() of unsized object

When the values are not tuples, or when you have a regular index, or when using ix/loc/iloc this issue does not appear.

This issue is coming from geopandas (geopandas/geopandas#351), where a Series of Point geometries give the same error:

In [66]: import shapely.geometry

In [67]: s = pd.Series([(1,1),(2,2),(3,3)], index=[0.0,0.1,0.2])

In [68]: s = s.map(shapely.geometry.Point)

In [69]: s
Out[69]:
0.0    POINT (1 1)
0.1    POINT (2 2)
0.2    POINT (3 3)
dtype: object

In [70]: s[0.0]
...
TypeError: len() of unsized object