-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
ERR: improve error message with unalignable label indexing #14491
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
Comments
I think the error message is rather clear: "Unalignable boolean Series key provided" -> the index of the boolean series is not alignable with the index of the DataFrame you are trying to index. Lists or arrays don't have an index, so there is not an issue. If you want to ignore the index of the series, you can use Not sure if this is documented somewhere thoroughly. |
Understood, but then it is mainly the error message that is very confusing: A series of length 3 is alignable intuitively with a length-3-dataframe, it is just not what Pandas considers alignable. |
Ah yes, it is unalignable on the labels of the indices (although the length matches). That is what the term 'alignment' means in pandas-world. |
ok will mark this for error message improvement @bluenote10 if you'd like to submit a PR. I suppose you could mention that this is label alignment would be enough. |
ERR: Change error message pandas-dev#14491 ENH: pandas-dev#11897 make lint work. ERR: pandas-dev#14491 change error message ERR: pandas-dev#14491 fix test for error message fixes based on jreback feedback fix indent issue Doc fixes Fixes per jreback comments
ERR: Change error message pandas-dev#14491
ERR: Change error message pandas-dev#14491
A small, complete example of the issue
Using a boolean index in a
pandas.Series
on a data frame with an string index fails withUnalignable boolean Series key provided
:Expected Output
Boolean indexing should work with a
pandas.Series
like it does with regular Python lists and boolean numpy arrays.Output of
pd.show_versions()
commit: None
python: 2.7.6.final.0
python-bits: 64
OS: Linux
OS-release: 3.13.0-98-generic
machine: x86_64
processor: x86_64
byteorder: little
LC_ALL: None
LANG: en_US.UTF-8
pandas: 0.18.1
nose: None
pip: 8.1.2
setuptools: 27.2.0
Cython: 0.24.1
numpy: 1.11.1
scipy: 0.18.0
statsmodels: None
xarray: None
IPython: 5.1.0
sphinx: None
patsy: None
dateutil: 2.5.3
pytz: 2016.6.1
blosc: None
bottleneck: 1.1.0
tables: None
numexpr: 2.6.1
matplotlib: 1.5.3
openpyxl: None
xlrd: None
xlwt: None
xlsxwriter: None
lxml: None
bs4: None
html5lib: None
httplib2: None
apiclient: None
sqlalchemy: None
pymysql: None
psycopg2: None
jinja2: None
boto: None
pandas_datareader: None
The text was updated successfully, but these errors were encountered: