Description
iloc
doesn't error when passing a boolean mask that is too long (as long as the values are False). The same is true for Series.
import pandas as pd
d = pd.DataFrame([1, 2])
d.iloc[[True, True, False]] # does not error even though index is too long
d.iloc[[True, True, True]] # error as expected
Sorry, not sure if this is an expected behaviour, but I was quite surprised at first.
Output of pd.show_versions()
INSTALLED VERSIONS
commit: None
python: 3.7.3.final.0
python-bits: 64
OS: Linux
OS-release: 5.1.4-arch1-1-ARCH
machine: x86_64
processor:
byteorder: little
LC_ALL: None
LANG: en_US.UTF-8
LOCALE: en_US.UTF-8
pandas: 0.24.2
pytest: 4.6.2
pip: 19.0.3
setuptools: 40.8.0
Cython: 0.29.10
numpy: 1.16.2
scipy: 1.3.0
pyarrow: None
xarray: None
IPython: 7.4.0
sphinx: 3.0.0
patsy: 0.5.1
dateutil: 2.8.0
pytz: 2018.9
blosc: None
bottleneck: None
tables: None
numexpr: None
feather: None
matplotlib: 3.1.0
openpyxl: None
xlrd: None
xlwt: None
xlsxwriter: None
lxml.etree: None
bs4: None
html5lib: None
sqlalchemy: None
pymysql: None
psycopg2: None
jinja2: 2.10
s3fs: None
fastparquet: None
pandas_gbq: None
pandas_datareader: None
gcsfs: None