From a437f3e2c1ffe90c2fb837553f0948cabcfb5f67 Mon Sep 17 00:00:00 2001 From: Patrick Hoefler Date: Sun, 19 Feb 2023 14:50:40 +0100 Subject: [PATCH 1/4] DOC: Add comment about inplace/copy proposal --- .../getting_started/comparison/includes/copies.rst | 14 ++++++++++++++ doc/source/whatsnew/v2.0.0.rst | 9 +++++++++ 2 files changed, 23 insertions(+) diff --git a/doc/source/getting_started/comparison/includes/copies.rst b/doc/source/getting_started/comparison/includes/copies.rst index e55d085faecb3..06db025950877 100644 --- a/doc/source/getting_started/comparison/includes/copies.rst +++ b/doc/source/getting_started/comparison/includes/copies.rst @@ -11,3 +11,17 @@ or overwrite the original one: .. code-block:: python df = df.sort_values("col1") + +.. note:: + + You will see an ``inplace=True`` or ``copy=False`` keyword argument available for + some methods: + + .. code-block:: python + + df.replace(5, inplace=True) + + There is an active discussion about deprecating and removing ``inplace`` and ``copy`` + except for a very small subset of methods. Both keywords won't be necessary anymore + in the context of Copy-on-Write. The proposal can be found + [here](https://github.com/pandas-dev/pandas/pull/51466). diff --git a/doc/source/whatsnew/v2.0.0.rst b/doc/source/whatsnew/v2.0.0.rst index df958a63c4528..1651a0b29135c 100644 --- a/doc/source/whatsnew/v2.0.0.rst +++ b/doc/source/whatsnew/v2.0.0.rst @@ -1423,6 +1423,15 @@ Metadata Other ^^^^^ + +.. note:: + + A current PDEP proposes the deprecation and removal of the keywords ``inplace`` and ``copy`` + for all but a small subset of methods from the pandas API. The current discussion takes place + at [here](https://github.com/pandas-dev/pandas/pull/51466). The keywords won't be necessary + anymore in the context of Copy-on-Write. If this proposal is accepted, both + keywords would be deprecated in the next release of pandas and removed in pandas 3.0. + - Bug in :meth:`Series.searchsorted` inconsistent behavior when accepting :class:`DataFrame` as parameter ``value`` (:issue:`49620`) - Bug in :func:`array` failing to raise on :class:`DataFrame` inputs (:issue:`51167`) - From f1467497dc7b52ed58ebdff56d47a18d9ad41082 Mon Sep 17 00:00:00 2001 From: Patrick Hoefler Date: Mon, 20 Feb 2023 10:55:12 +0000 Subject: [PATCH 2/4] Move note --- doc/source/whatsnew/v2.0.0.rst | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/doc/source/whatsnew/v2.0.0.rst b/doc/source/whatsnew/v2.0.0.rst index 1651a0b29135c..612d0f06071b7 100644 --- a/doc/source/whatsnew/v2.0.0.rst +++ b/doc/source/whatsnew/v2.0.0.rst @@ -818,6 +818,14 @@ Other API changes - Added :func:`pandas.api.types.is_any_real_numeric_dtype` to check for real numeric dtypes (:issue:`51152`) - +.. note:: + + A current PDEP proposes the deprecation and removal of the keywords ``inplace`` and ``copy`` + for all but a small subset of methods from the pandas API. The current discussion takes place + at [here](https://github.com/pandas-dev/pandas/pull/51466). The keywords won't be necessary + anymore in the context of Copy-on-Write. If this proposal is accepted, both + keywords would be deprecated in the next release of pandas and removed in pandas 3.0. + .. --------------------------------------------------------------------------- .. _whatsnew_200.deprecations: @@ -1424,14 +1432,6 @@ Metadata Other ^^^^^ -.. note:: - - A current PDEP proposes the deprecation and removal of the keywords ``inplace`` and ``copy`` - for all but a small subset of methods from the pandas API. The current discussion takes place - at [here](https://github.com/pandas-dev/pandas/pull/51466). The keywords won't be necessary - anymore in the context of Copy-on-Write. If this proposal is accepted, both - keywords would be deprecated in the next release of pandas and removed in pandas 3.0. - - Bug in :meth:`Series.searchsorted` inconsistent behavior when accepting :class:`DataFrame` as parameter ``value`` (:issue:`49620`) - Bug in :func:`array` failing to raise on :class:`DataFrame` inputs (:issue:`51167`) - From a6ff05ef70dec315c95cb20414d00450d6346b1d Mon Sep 17 00:00:00 2001 From: Patrick Hoefler Date: Mon, 20 Feb 2023 12:01:30 +0000 Subject: [PATCH 3/4] Adjust comment --- doc/source/getting_started/comparison/includes/copies.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/source/getting_started/comparison/includes/copies.rst b/doc/source/getting_started/comparison/includes/copies.rst index 06db025950877..29ce98987e213 100644 --- a/doc/source/getting_started/comparison/includes/copies.rst +++ b/doc/source/getting_started/comparison/includes/copies.rst @@ -22,6 +22,6 @@ or overwrite the original one: df.replace(5, inplace=True) There is an active discussion about deprecating and removing ``inplace`` and ``copy`` - except for a very small subset of methods. Both keywords won't be necessary anymore - in the context of Copy-on-Write. The proposal can be found + except for a very small subset of methods (including ``replace``). Both keywords won't be + necessary anymore in the context of Copy-on-Write. The proposal can be found [here](https://github.com/pandas-dev/pandas/pull/51466). From 94592d80bc5b4ba57a2e37ea97c2cfb634deac61 Mon Sep 17 00:00:00 2001 From: Patrick Hoefler Date: Mon, 20 Feb 2023 14:13:41 +0000 Subject: [PATCH 4/4] Adjust comment --- doc/source/getting_started/comparison/includes/copies.rst | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/doc/source/getting_started/comparison/includes/copies.rst b/doc/source/getting_started/comparison/includes/copies.rst index 29ce98987e213..d0f3d26332d98 100644 --- a/doc/source/getting_started/comparison/includes/copies.rst +++ b/doc/source/getting_started/comparison/includes/copies.rst @@ -21,7 +21,8 @@ or overwrite the original one: df.replace(5, inplace=True) - There is an active discussion about deprecating and removing ``inplace`` and ``copy`` - except for a very small subset of methods (including ``replace``). Both keywords won't be + There is an active discussion about deprecating and removing ``inplace`` and ``copy`` for + most methods (e.g. ``dropna``) except for a very small subset of methods + (including ``replace``). Both keywords won't be necessary anymore in the context of Copy-on-Write. The proposal can be found [here](https://github.com/pandas-dev/pandas/pull/51466).