-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Indexing a mulitIndex with a series fails #14730
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
So which should be the answer?
This is the correct method. There is not enough information to directly index above.
This is not a bug, rather a nice doc example. |
That's clear thank you. I think my ground assumption was that passing any iterable as an index to Your second example is exactly what I was looking for. Many thanks for suggesting adding to docs too, hope it will help somebody else in future. |
if u would like to do a pull request for the docs would be great |
Will do. Would this belong in multiindex / advanced indexing ? |
yes, I would make a |
@jreback why do you find this not obvious in case of a multi-index, but not a problem in case of single index?
And you could ask the same question for Our docs say that the argument to |
As far as I'm aware I found |
yeah I guess this could be a bug; should work same for Index and MultiIndex; we always do use the values (and not the index of the indexer). |
A little late, just wanted to say thanks for getting this addressed so quickly! |
Code Sample
Problem description
In pandas you can index a DataFrame or Series with a list, ndarray, series, etc. But this fails when using a muliIndex.
Expected Output
No failures
Error message
Output of
pd.show_versions()
INSTALLED VERSIONS
commit: None
python: 3.5.2.final.0
python-bits: 64
OS: Linux
OS-release: 4.4.0-47-generic
machine: x86_64
processor: x86_64
byteorder: little
LC_ALL: None
LANG: en_GB.UTF-8
LOCALE: en_GB.UTF-8
pandas: 0.19.1
nose: None
pip: 8.1.2
setuptools: 27.2.0
Cython: None
numpy: 1.11.2
scipy: None
statsmodels: None
xarray: None
IPython: 5.1.0
sphinx: None
patsy: None
dateutil: 2.5.3
pytz: 2016.7
blosc: None
bottleneck: None
tables: None
numexpr: None
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: 2.8
boto: None
pandas_datareader: None
The text was updated successfully, but these errors were encountered: