BUG: DataFrame.loc/iloc setitem with empty or boolean column indexer on EA dtypes (GH#66255)#66304
Open
chang-pro wants to merge 2 commits into
Open
BUG: DataFrame.loc/iloc setitem with empty or boolean column indexer on EA dtypes (GH#66255)#66304chang-pro wants to merge 2 commits into
chang-pro wants to merge 2 commits into
Conversation
…on EA dtypes (GH#66255)
…EA setitem Follow-up hardening for GH#66255: empty slices, list-like row indexers with empty column lists, and 2-D empty indexers from maybe_convert_ix are now no-ops that skip value validation entirely, matching numpy-backed columns. Object-dtype indexer arrays raise IndexError the same way numpy does instead of silently selecting the whole column.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
doc/source/whatsnew/vX.X.X.rstfile if fixing a bug or adding a new feature.AGENTS.md.EABackedBlock._unwrap_setitem_indexerinterpreted a boolean column indexer as a positional one:indexer[1][0] == 0is true fornp.array([False]), so an all-False column mask unwrapped to the row indexer and set the entire column. The same branch raisedIndexErrorfor an empty positional indexer (iloc[:, []]) andNotImplementedErrorfor an all-True mask. All three now behave like the numpy-dtype path:Affects all extension array dtypes (masked and arrow-backed). The bool handling is restricted to length-1 masks so multi-column 2D EA blocks keep their current behavior. loc/iloc/masked/internals suites pass (8089 tests).