Code Sample, a copy-pastable example if possible

df = pd.DataFrame(
    {
        "a":[11, 11, 22],
        "i":[1081., 1071., 22.],
    },
)
df = df.set_index("i")
# df.index = df.set_index("i").astype(int)
print df.loc[[-99999999]]

Problem description

The above gets:

            a
i            
-99999999 NaN

... where did this row come from? Was not in my data.

Expected Output

`KeyError: u'None of [[-99999999]] are in the [index]'

Output of pd.show_versions()

INSTALLED VERSIONS ------------------ commit: None python: 2.7.6.final.0 python-bits: 64 OS: Linux OS-release: 3.13.0-24-generic machine: x86_64 processor: x86_64 byteorder: little LC_ALL: None LANG: en_US.UTF-8 LOCALE: None.None pandas: 0.22.0 pytest: None pip: 9.0.1 setuptools: 36.0.1 Cython: 0.27.3 numpy: 1.13.3 scipy: 1.0.0 pyarrow: None xarray: None IPython: 5.3.0 sphinx: None patsy: 0.2.1 dateutil: 2.6.1 pytz: 2017.2 blosc: None bottleneck: None tables: 3.1.1 numexpr: 2.6.2 feather: None matplotlib: 2.0.2 openpyxl: 1.7.0 xlrd: 0.9.2 xlwt: 0.7.5 xlsxwriter: None lxml: None bs4: None html5lib: 0.999999999 sqlalchemy: 1.0.15 pymysql: None psycopg2: 2.7.3.2 (dt dec pq3 ext lo64) jinja2: 2.9.6 s3fs: None fastparquet: None pandas_gbq: None pandas_datareader: None

Comment From: jschendel

To expand slightly: this only appears to be an issue with Float64Index, other indexes appear to be behaving properly.

The FutureWarning for partial matches also does not appear to be working for Float64Index:

In [2]: s = pd.Series(['foo', 'bar', 'baz'], index=pd.Float64Index([0, 1, 2]))

In [3]: s
Out[3]:
0.0    foo
1.0    bar
2.0    baz
dtype: object

In [4]: s.loc[[2.0, 3.0]]
Out[4]:
2.0    baz
3.0    NaN
dtype: object

Whereas the FutureWarning works for other types of index, e.g. RangeIndex:

In [5]: s2 = pd.Series(['foo', 'bar', 'baz'])

In [6]: s2
Out[6]:
0    foo
1    bar
2    baz
dtype: object

In [7]: s2.loc[[2, 3]]
FutureWarning:
Passing list-likes to .loc or [] with any missing label will raise
KeyError in the future, you can use .reindex() as an alternative.

See the documentation here:
https://pandas.pydata.org/pandas-docs/stable/indexing.html#deprecate-loc-reindex-listlike
  if __name__ == '__main__':
Out[7]:
2    baz
3    NaN
dtype: object

Comment From: alexcwatt

Using the copy/paste example in the original issue description, I am unable to reproduce this on master with Python 3.6.6; I see the expected KeyError raised.

Comment From: WillAyd

@alexcwatt can you see if we have a test for this? If not would take a PR to add one

Comment From: phofl

test_loc_getitem_label_out_of_range in pandas/tests/indexing/test_loc.py covers this.