Skip to content

BUG: DataFrame loc set incorrectly aligns on scalar column assignment…#65852

Open
pranavchoudhary-tech wants to merge 5 commits into
pandas-dev:mainfrom
pranavchoudhary-tech:BUG/loc-scalar-column-dataframe-alignment
Open

BUG: DataFrame loc set incorrectly aligns on scalar column assignment…#65852
pranavchoudhary-tech wants to merge 5 commits into
pandas-dev:mainfrom
pranavchoudhary-tech:BUG/loc-scalar-column-dataframe-alignment

Conversation

@pranavchoudhary-tech

@pranavchoudhary-tech pranavchoudhary-tech commented Jun 10, 2026

Copy link
Copy Markdown

… (#58482)

When setting a scalar column with a DataFrame value using , pandas would take a single-block fastpath that completely skipped alignment, resulting in the assignment proceeding purely by position. This updates
to extract the correct column from the DataFrame
and align it properly before using the fastpath.

…pandas-dev#58482)

When setting a scalar column with a DataFrame value using , pandas
would take a single-block fastpath that completely skipped alignment,
resulting in the assignment proceeding purely by position. This updates
 to extract the correct column from the DataFrame
and align it properly before using the fastpath.
@pranavchoudhary-tech

Copy link
Copy Markdown
Author

I've pushed a fix that resolves the TypeError test failures in the CI. The dataframe alignment logic is no longer being bypassed during the single-block fast path, and all test_loc checks are passing locally. Ready for review!

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's loc set works incorrectly with scalar column key and single value DataFrame item

1 participant