Following:
df = pd.DataFrame(
{
"a":[11, 11, 22],
"i":[1081., 1071., 22.],
},
)
df = df.set_index("i")
print df.loc[[-99999999]]
Gets:
a
i
-99999999 NaN
However, if the index is more reasonably populated with ints, then Pandas reasonably complains:
KeyError: u'None of [[-99999999]] are in the [index]'
What's up with that? Why do the float and int indexes behave differently and what is the rationale for inventing magic strings?
source
share