PDEP-8 inplace keyword deprecation - implementation tracker issue (original) (raw)
Issue to track the progress of implementing the accepted PDEP-8: https://pandas.pydata.org/pdeps/0008-inplace-methods-in-pandas.html
Summary of the PDEP proposed changes:
- The
inplaceparameter will be removed from any method which can never update the
underlying values of a pandas object inplace or which alters the shape of the object,
and where theinplace=Trueoption is only syntactic sugar for reassigning the result
to the calling DataFrame/Series.- In practice, this are the methods
drop,rename,rename_axis,reset_index,set_index,dropnadrop_duplicates,sort_values,sort_index,eval,query
- In practice, this are the methods
- The
inplaceparameter is kept for those methods that can
modify the underlying values of a pandas object inplace, such asfillnaorreplace, and those methods will return the calling object (self), instead of the currentNone. - With the introduction of Copy-on-Write (PDEP-7), users don't need the
inplacekeyword to avoid a copy of the data.
List of TODO items:
For 3.0:
- Start returning
selfinstead ofNonefor the methods that will keep theinplacekeyword: PDEP-8 inplace: return self for inplace=True in methods that will keep the keyword #63195 - Announce the future deprecation and update documentation to already discourage usage of it (the user guide already does not mention it, but docstrings could use some update to discourage use / mention future deprecation)
For 3.1:
- Add actual deprecation warnings to the methods where we will remove the keyword in the future (4.0)