BUG: loc/iloc setitem with boolean column indexer raising for single EA column (GH#66527) - #66534
Open
Mohith26 wants to merge 2 commits into
Open
BUG: loc/iloc setitem with boolean column indexer raising for single EA column (GH#66527)#66534Mohith26 wants to merge 2 commits into
Mohith26 wants to merge 2 commits into
Conversation
…otImplementedError for single EA column (GH#66527) A boolean column indexer reaching _setitem_single_block was passed through to the block layer as a boolean array, which ExtensionBlock._unwrap_setitem_indexer does not handle. Convert it to positional integers, matching what the split path does via _ensure_iterable_column_indexer. Also handle a zero-column selection (e.g. df.loc[:, []] or an all-False mask) in _unwrap_setitem_indexer, which previously raised IndexError.
…r on single EA column (GH#66527)
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.
Fixes #66527.
df.loc[:, bool_mask] = value(and the iloc equivalent) raisedNotImplementedErrorwhen the boolean column indexer selected a single column backed by an extension array, because the setitem path converted the mask to a positional indexer shape the EA block could not handle.The fix normalizes the boolean column indexer in the setitem path so single-EA-column selections take the same route as their non-EA equivalents; all-False masks remain a no-op. Whatsnew entry under v3.1.0.
Three regression tests (
# GH#66527): iloc and loc setitem with a boolean column indexer on a single EA column, plus the all-False mask no-op. All three fail without the fix; indexing suites pass with zero new failures (263 passed in test_iloc.py, loc subset green).