Skip to content

BUG: Do not allow boolean values for indexing with .loc without a boolean index. #40726

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

Merged
merged 19 commits into from
Apr 6, 2021

Conversation

DriesSchaumont
Copy link
Member

@DriesSchaumont DriesSchaumont commented Apr 1, 2021

@DriesSchaumont DriesSchaumont marked this pull request as ready for review April 1, 2021 13:29
@jreback jreback added Error Reporting Incorrect or improved errors from pandas Indexing Related to indexing on series/frames, not to indexes themselves labels Apr 2, 2021
@phofl
Copy link
Member

phofl commented Apr 2, 2021

Please add whatsnew

@DriesSchaumont
Copy link
Member Author

Please add whatsnew

Added.

@phofl
Copy link
Member

phofl commented Apr 2, 2021

CI failure seems related

@DriesSchaumont
Copy link
Member Author

CI failure seems related

Yes, indeed. I could fix most of the failing tests with specifying the dtypes. But for some reason specifying dtype="boolean" does not remove the warning. This is a separate issue though.

@DriesSchaumont
Copy link
Member Author

CI failure seems related

Yes, indeed. I could fix most of the failing tests with specifying the dtypes. But for some reason specifying dtype="boolean" does not remove the warning. This is a separate issue though.

I must have been tired. dtype="boolean" was not passed to the df or series, but to the index. Fixed and expect CI to be green.

@phofl
Copy link
Member

phofl commented Apr 5, 2021

Small comments, otherwise lgtm, pls merge master too

@pep8speaks
Copy link

pep8speaks commented Apr 6, 2021

Hello @DriesSchaumont! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:

There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻

Comment last updated at 2021-04-06 15:29:28 UTC

@phofl
Copy link
Member

phofl commented Apr 6, 2021

lgtm cc @jreback @jbrockmendel

@phofl phofl added this to the 1.3 milestone Apr 6, 2021
@jreback
Copy link
Contributor

jreback commented Apr 6, 2021

@DriesSchaumont did you post the updated asv's?

@phofl
Copy link
Member

phofl commented Apr 6, 2021

#40726 (comment)

Here

@jreback
Copy link
Contributor

jreback commented Apr 6, 2021

@phofl pls merge!

@phofl phofl merged commit 3b4b193 into pandas-dev:master Apr 6, 2021
@phofl
Copy link
Member

phofl commented Apr 6, 2021

thanks @DriesSchaumont

@DriesSchaumont DriesSchaumont deleted the fix-20432 branch April 6, 2021 19:25
JulianWgs pushed a commit to JulianWgs/pandas that referenced this pull request Jul 3, 2021
…lean index. (pandas-dev#40726)

* Add boolean loc tests.

* BUG: Raise TypeError when using boolean indexer with loc.

* Fix styling issues.

* Adjustments for review.

* Add whatsnew entry.

* Switch boolean statements.

* Switch to KeyError.

* Switch to KeyError pt.2

* Remove stray dot in whatsnew

* Fix DeprecationWarning.

* Fix DeprecationWarning pt.2

* Adjustments to comments.

* Adjustments to comments pt. 2.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Error Reporting Incorrect or improved errors from pandas Indexing Related to indexing on series/frames, not to indexes themselves
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BUG: DataFrame/Series.loc improperly allows lookups of boolean labels/slices
4 participants