Skip to content

DOC: Document Series reindexing behavior on DataFrame column assignment#64741

Open
shivamshinde123 wants to merge 1 commit intopandas-dev:mainfrom
shivamshinde123:doc-reindexing-series-assignment
Open

DOC: Document Series reindexing behavior on DataFrame column assignment#64741
shivamshinde123 wants to merge 1 commit intopandas-dev:mainfrom
shivamshinde123:doc-reindexing-series-assignment

Conversation

@shivamshinde123
Copy link

Summary

Documents the reindexing behavior when assigning a Series to a DataFrame column via .loc or []. This behavior (alignment by index labels, not position) was not clearly documented.

Changes

  • pandas/core/indexing.py (loc docstring): Expanded the "Assignment with Series" section with clearer explanation and two examples — one showing index reordering and one showing partial index match with NaN fill.
  • doc/source/user_guide/indexing.rst: Added a new "Series alignment on assignment" subsection under "Setting with enlargement" explaining the four key behaviors with examples.

Disclosure

This contribution was made with the assistance of an AI coding tool (Claude Code). The changes have been fully reviewed and verified — all doctest outputs were validated against actual pandas behavior.

@shivamshinde123
Copy link
Author

@mroeschke Could you please review this PR? Thanks.

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.

DOC: Reindexing behaviour of dataframe column-assignment missing

1 participant