Skip to content

ENH: add inplace-kwarg to update #21858

Open
@h-vetinari

Description

@h-vetinari

Currently, df.update follows the convention of dict.update to return None and update inplace. This is against the prevailing trend (and philosopy?) of pandas to move away from inplace. See for example (one among many...) @TomAugspurger's response in #21841:

Generally, we're moving away from inplace operations. It's confusing whether inplace means no copy or not. Reindex, by definition, can't be inplace unless the index is the same.
We recommend chaining your method calls, and hope to provide better memory control in the future.

The update-method of perfoms an important function regardless of whether it returns the object or None, and so should IMO be enabled to work in chained operations as well.

First step there would be adding an inplace-argument with default True, and then -- potentially -- transitioning with a longish deprecation cycle towards inplace=False.

Relevant xrefs: #21855 #21859

Metadata

Metadata

Assignees

No one assigned

    Labels

    EnhancementReshapingConcat, Merge/Join, Stack/Unstack, ExplodeinplaceRelating to inplace parameter or equivalent

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions