Description
Code Sample
import pandas as pd
import numpy as np
df = pd.DataFrame(data=np.array([[1,2,3,4],[5,6,7,8],[1,2,np.nan,np.nan]]).T,columns=('a','b','c'),dtype="Int64")
df2 = df.set_index('c')
df2.loc[1]
Problem description
When there is more than one missing value in the dataframe index, indexing into the dataframe results in
TypeError: Cannot convert bool to numpy.ndarray
If only one NaN index exists, this works:
df = pd.DataFrame(data=np.array([[1,2,3,4],[5,6,7,8],[1,2,3,np.nan]]).T,columns=('a','b','c'),dtype="Int64")
df2 = df.set_index('c')
df2.loc[1]
a 1
b 5
Name: 1, dtype: Int64
Expected Output
I Expect df2.loc[1]
to return
a 1
b 5
Name: 1, dtype: Int64
Output of pd.show_versions()
INSTALLED VERSIONS
commit : None
python : 3.6.9.final.0
python-bits : 64
OS : Linux
OS-release : 5.3.0-53-generic
machine : x86_64
processor : x86_64
byteorder : little
LC_ALL : None
LANG : en_US.UTF-8
LOCALE : en_US.UTF-8
pandas : 1.0.3
numpy : 1.18.2
pytz : 2019.3
dateutil : 2.8.1
pip : 20.1.1
setuptools : 46.1.3.post20200330
Cython : 0.29.15
pytest : None
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : None
lxml.etree : 4.2.1
html5lib : 0.999999999
pymysql : None
psycopg2 : None
jinja2 : 2.11.1
IPython : 7.13.0
pandas_datareader: None
bs4 : 4.6.0
bottleneck : None
fastparquet : None
gcsfs : None
lxml.etree : 4.2.1
matplotlib : 3.1.2
numexpr : 2.6.4
odfpy : None
openpyxl : 3.0.3
pandas_gbq : None
pyarrow : None
pytables : None
pytest : None
pyxlsb : None
s3fs : None
scipy : 1.4.1
sqlalchemy : None
tables : 3.4.2
tabulate : 0.8.7
xarray : None
xlrd : 1.2.0
xlwt : None
xlsxwriter : None
numba : 0.48.0