Skip to content

Commit 0ff288c

Browse files
authored
DOC: discourage use of inplace=True in comparion pages
1 parent 2522866 commit 0ff288c

File tree

1 file changed

+10
-7
lines changed
  • doc/source/getting_started/comparison/includes

1 file changed

+10
-7
lines changed
Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,23 @@
11
Most pandas operations return copies of the ``Series``/``DataFrame``. To make the changes "stick",
2-
you'll need to either:
3-
4-
* Assign back to the same variable
2+
you'll need to either assign to a new variable:
53

64
.. code-block:: python
75
8-
df = df.sort_values("col1")
6+
sorted_df = df.sort_values("col1")
7+
98
10-
* Assign to a new variable
9+
or overwrite the original one:
1110

1211
.. code-block:: python
1312
14-
sorted_df = df.sort_values("col1")
13+
df = df.sort_values("col1")
1514
16-
* Use the ``inplace=True`` keyword argument, where available
15+
.. note::
16+
17+
You will see an ``inplace=True`` keyword argument available for some methods:
1718

1819
.. code-block:: python
1920
2021
df.sort_values("col1", inplace=True)
22+
23+
Its use is discouraged. :ref:`More information. <indexing.view_versus_copy>`

0 commit comments

Comments
 (0)