[Pandas-dev] PDEP-8: In-place methods in pandas (i.e. deprecating the inplace keyword)
Joris Van den Bossche
jorisvandenbossche at gmail.com
Tue Dec 5 05:45:56 EST 2023
Reminder about this discussion: if there are no more comments, we are
planning to start a vote in a few days.
On Mon, 13 Nov 2023 at 15:53, Joris Van den Bossche <
jorisvandenbossche at gmail.com> wrote:
> Hi list,
>
> There is proposal to deprecate and eventually remove the `inplace` keyword
> (in most places): PDEP-8 (https://github.com/pandas-dev/pandas/pull/51466).
> This has been open for quite a while, and I just updated the text to
> reflect the latest state of the discussion, and wanted to bring this up on
> the mailing list here as well.
>
> Feedback goes to the PR: https://github.com/pandas-dev/pandas/pull/51466
> If you want to see a rendered version of the text:
> https://jorisvandenbossche.github.io/pandas-website-preview/pdeps/0008-inplace-methods-in-pandas.html
> (our website does not yet render them before being merged)
>
> And posting the abstract here as well. The PDEP proposes:
>
> -
>
> The inplace parameter 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 the inplace=True option is only
> syntactic sugar for reassigning the result to the calling DataFrame/Series.
> -
>
> As a consequence, the inplace parameter is only kept for those methods
> that can modify the underlying values of a pandas object inplace, such as
> fillna or replace.
> -
>
> With the introduction of Copy-on-Write (PDEP-7[1]
> <https://jorisvandenbossche.github.io/pandas-website-preview/pdeps/0008-inplace-methods-in-pandas.html#id9>),
> users don’t need the inplace keyword to avoid a copy of the data.
> -
>
> For those methods that will keep the inplace=True option:
> -
>
> the method will do an attempt to do the operation inplace but still
> silently copy when needed (for Copy-on-Write), i.e. there is no guarantee
> it is actually done inplace.
> -
>
> the method will return the calling object (self), instead of the
> current None.
>
>
> For the full proposal and motivation, see the links above.
>
> Feedback welcome!
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.python.org/pipermail/pandas-dev/attachments/20231205/a43046bd/attachment.html>
More information about the Pandas-dev
mailing list