Skip to content

BUG: loc/iloc setitem with boolean column indexer raising for single EA column (GH#66527) - #66534

Open
Mohith26 wants to merge 2 commits into
pandas-dev:mainfrom
Mohith26:fix/loc-boolean-column-indexer
Open

BUG: loc/iloc setitem with boolean column indexer raising for single EA column (GH#66527)#66534
Mohith26 wants to merge 2 commits into
pandas-dev:mainfrom
Mohith26:fix/loc-boolean-column-indexer

Conversation

@Mohith26

Copy link
Copy Markdown

Fixes #66527.

df.loc[:, bool_mask] = value (and the iloc equivalent) raised NotImplementedError when 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).

Mohith26 added 2 commits July 29, 2026 02:15
…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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BUG: DataFrame.loc assignment with boolean column indexer raises NotImplementedError for single-column DataFrame

1 participant