File tree Expand file tree Collapse file tree 1 file changed +10
-7
lines changed
doc/source/getting_started/comparison/includes Expand file tree Collapse file tree 1 file changed +10
-7
lines changed Original file line number Diff line number Diff line change 1
1
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:
5
3
6
4
.. code-block :: python
7
5
8
- df = df.sort_values(" col1" )
6
+ sorted_df = df.sort_values(" col1" )
7
+
9
8
10
- * Assign to a new variable
9
+ or overwrite the original one:
11
10
12
11
.. code-block :: python
13
12
14
- sorted_df = df.sort_values(" col1" )
13
+ df = df.sort_values(" col1" )
15
14
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:
17
18
18
19
.. code-block :: python
19
20
20
21
df.sort_values(" col1" , inplace = True )
22
+
23
+ Its use is discouraged. :ref: `More information. <indexing.view_versus_copy >`
You can’t perform that action at this time.
0 commit comments