Skip to content

DOC: clarify "inplace"-ness of DataFrame.setitem #51328

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Feb 20, 2023
Merged

DOC: clarify "inplace"-ness of DataFrame.setitem #51328

merged 7 commits into from
Feb 20, 2023

Conversation

loicdiridollou
Copy link
Contributor

@loicdiridollou loicdiridollou changed the title DOC: clarify inplace-ness of DataFrame.setitem DOC: clarify "inplace"-ness of DataFrame.setitem Feb 11, 2023
@mroeschke mroeschke added the Docs label Feb 13, 2023
Copy link
Member

@jorisvandenbossche jorisvandenbossche left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@loicdiridollou thanks a lot for the PR! I think the general wording is good, I just added a few tiny comments.

``frame.isetimtem(loc, value)`` is an in-place method as it will
modify the frame in place (not returning a new object) but it will
not update the values of the column itself, it will instead insert
a new array.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would add something like "in contrast to frame.iloc[:, i] = value which will try to update the existing values inplace"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just made some examples on my side and indeed this is quite important to keep that in the docs, I will update that

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should be good now, let me know if the phrasing is clear enough

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should be good now, let me know if the phrasing is clear enough

Copy link
Member

@jorisvandenbossche jorisvandenbossche left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks!

Copy link
Member

@jbrockmendel jbrockmendel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jorisvandenbossche jorisvandenbossche added this to the 2.0 milestone Feb 17, 2023
@phofl
Copy link
Member

phofl commented Feb 20, 2023

thx @loicdiridollou

lets backport, this is nice to have for CoW

meeseeksmachine pushed a commit to meeseeksmachine/pandas that referenced this pull request Feb 20, 2023
phofl added a commit that referenced this pull request Feb 21, 2023
…taFrame.setitem) (#51512)

Backport PR #51328: DOC: clarify "inplace"-ness of DataFrame.setitem

Co-authored-by: Loic Diridollou <[email protected]>
Co-authored-by: Patrick Hoefler <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

DOC: clarify "inplace"-ness of DataFrame.setitem
5 participants