Skip to content
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

QST: pd.series indexing True auto 0 change #48653

Closed
2 tasks done
sc303030 opened this issue Sep 20, 2022 · 2 comments · Fixed by #48662
Closed
2 tasks done

QST: pd.series indexing True auto 0 change #48653

sc303030 opened this issue Sep 20, 2022 · 2 comments · Fixed by #48662
Labels
Indexing Related to indexing on series/frames, not to indexes themselves Regression Functionality that used to work in a prior pandas version
Milestone

Comments

@sc303030
Copy link

Research

  • I have searched the [pandas] tag on StackOverflow for similar questions.

  • I have asked my usage related question on StackOverflow.

Link to question on StackOverflow

https://stackoverflow.com/questions/73783112/1-4-4-other-1-5-0-pd-series-indexing-true-auto-0-change

Question about pandas

test = pd.Series({True: 0, False: 0})

1.4.4
print(test[0])
> 0

but 
1.5.0
print(test[True])

> keyerror 0

1.4.4 and 1.5.0 What has changed?I can't find it

@sc303030 sc303030 added Needs Triage Issue that has not been reviewed by a pandas team member Usage Question labels Sep 20, 2022
@phofl
Copy link
Member

phofl commented Sep 20, 2022

Hi, thanks for your report. test[True] works for me while test[0] does not. We are now supporting a boolean index, see #45061

@jbrockmendel I guess this is the correct behavior now?

@jbrockmendel
Copy link
Member

test.loc[1] should definitely raise, but it may be that test.index._should_fallback_to_positional should be True, in which case the __getitem__ call should still work (but would have different behavior on test[::-1])

@phofl phofl added Indexing Related to indexing on series/frames, not to indexes themselves Regression Functionality that used to work in a prior pandas version and removed Usage Question Needs Triage Issue that has not been reviewed by a pandas team member labels Sep 20, 2022
@phofl phofl added this to the 1.5.1 milestone Sep 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Indexing Related to indexing on series/frames, not to indexes themselves Regression Functionality that used to work in a prior pandas version
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants