Skip to content

iloc doesn't error when boolean mask is too long #27020

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
NicolasHug opened this issue Jun 24, 2019 · 1 comment
Closed

iloc doesn't error when boolean mask is too long #27020

NicolasHug opened this issue Jun 24, 2019 · 1 comment

Comments

@NicolasHug
Copy link
Contributor

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

@TomAugspurger
Copy link
Contributor

Yeah, not expected: #26658

We have an open PR: #26911. Should be merged today.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants