Skip to content

CoW: Boolean indexer in MultiIndex raising read-only error #56635

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 3 commits into from
Dec 28, 2023

Conversation

phofl
Copy link
Member

@phofl phofl commented Dec 27, 2023

Found this while going through the docs

@phofl phofl added Blocker Blocking issue or pull request for an upcoming release Copy / view semantics labels Dec 27, 2023
@phofl phofl added this to the 2.2 milestone Dec 27, 2023
@@ -3487,7 +3487,7 @@ def _to_bool_indexer(indexer) -> npt.NDArray[np.bool_]:
"cannot index with a boolean indexer that "
"is not the same length as the index"
)
lvl_indexer = np.asarray(k)
lvl_indexer = np.asarray(k).copy()
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not copying here propagates all the way to the input mask

@phofl phofl added the Indexing Related to indexing on series/frames, not to indexes themselves label Dec 28, 2023
@phofl phofl requested a review from mroeschke December 28, 2023 15:43
@mroeschke mroeschke merged commit 1888df3 into pandas-dev:main Dec 28, 2023
@mroeschke
Copy link
Member

Thanks @phofl

meeseeksmachine pushed a commit to meeseeksmachine/pandas that referenced this pull request Dec 28, 2023
@phofl phofl deleted the cow_read_only branch December 28, 2023 18:48
mroeschke pushed a commit that referenced this pull request Dec 28, 2023
…x raising read-only error) (#56660)

Backport PR #56635: CoW: Boolean indexer in MultiIndex raising read-only error

Co-authored-by: Patrick Hoefler <[email protected]>
cbpygit pushed a commit to cbpygit/pandas that referenced this pull request Jan 2, 2024
…v#56635)

* CoW: Boolean indexer in MultiIndex raising read-only error

* Fixup

* Add whatsnew
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Blocker Blocking issue or pull request for an upcoming release Copy / view semantics Indexing Related to indexing on series/frames, not to indexes themselves
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants