QST: pd.series indexing True auto 0 change

This issue has been tracked since 2022-09-20.

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

phofl wrote this answer on 2022-09-20

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 wrote this answer on 2022-09-21

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])

More Details About Repo
Owner Name pandas-dev
Repo Name pandas
Full Name pandas-dev/pandas
Language Python
Created Date 2010-08-24
Updated Date 2022-10-04
Star Count 35430
Watcher Count 1120
Fork Count 15089
Issue Count 3589

YOU MAY BE INTERESTED

Issue Title Created Date Updated Date