-
-
Notifications
You must be signed in to change notification settings - Fork 18.1k
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
BUG: Cannot select values in series using tuples when indexing with tuples in pandas 1.1.0 #35534
Comments
Thanks @lfiedler for the report This was changed with a bugfix #31112. @jbrockmendel I'm not sure what the bugfix was, no release note or added tests. f19035d is the first bad commit
|
It appears that the call to However, due to further changes in #31399, get_value is no longer called for a tuple indexer before the isinstance MultiIndex check. and the 'Can only tuple-index with a MultiIndex' message raised. |
This is pretty hairy, and likely to remain fragile even once fixed (e.g |
discussion in #24688. As there is not consensus there on deprecating tuples in index, we should restore the 1.0.5 behaviour for now. |
Agreed. |
I have checked that this issue has not already been reported.
I have confirmed this bug exists on the latest version of pandas.
(optional) I have confirmed this bug exists on the master branch of pandas.
Note: Please read this guide detailing how to provide the necessary information for us to reproduce your bug.
Code Sample, a copy-pastable example
Problem description
On pandas 1.0.5 selecting values of a series which is indexed by tuples was possible via
__getitem__
using the desired tuple (see above code). In pandas 1.1.0 this suddenly raises a ValueError:As this used to work in 1.0.5 and earlier versions (0.25 as far as I can recall) I expect this to be an unwanted side effect rather than a wanted change in behavior (in which case it would certainly be breaking).
Apart from this, I expected Series objects to behave to some degree like python dictionaries. In particular using tuples of strings as keys and selecting values by such tuples I think should be possible.
Expected Output
1
Output of
pd.show_versions()
The text was updated successfully, but these errors were encountered: