Skip to content

API/DEPR: Deprecate inplace parameter #16529

Open
@gfyoung

Description

The parameter inplace=False should be deprecated across the board in preparation for pandas 2, which will not support that input (we will always return a copy). That would give people time to stop using it.

Thoughts?

Methods using inplace:

Deprecation non controvertial (a copy will be made anyway, and inplace=True does not add value):

  • (Series/DataFrame).drop
  • (Series/DataFrame).drop_duplicates
  • (Series/DataFrame).dropna
  • DataFrame.set_index (with drop=False wouldn't change the data, but that doesn't seem the main use case)
  • DataFrame.query
  • DataFrame.eval

Not sure:

  • (Series/DataFrame).sort_values
  • (Series/DataFrame).sort_index

Should be able to not copy memory (under discussion on what to do):

  • (Series/DataFrame).clip
  • (Series/DataFrame).where
  • (Series/DataFrame).fillna
  • (Series/DataFrame).rename_axis
  • (Series/DataFrame).reset_index
  • (Series/DataFrame).replace
  • (Series/DataFrame).set_axis
  • (Series/DataFrame).mask
  • (Series/DataFrame).interpolate
  • DataFrame.rename
  • Index.rename
  • Index.set_names
  • MultiIndex.set_levels
  • MultiIndex.set_labels
  • pandas.core.resample.Resampler.interpolate

Special cases:

  • pandas.eval (with inplace=False the value is not returned but set to an argument target)

Metadata

Assignees

No one assigned

    Labels

    API DesignClosing CandidateMay be closeable, needs more eyeballsDeprecateFunctionality to remove in pandasNeeds DiscussionRequires discussion from core team before further actioninplaceRelating 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