Skip to content

Commit 22b2475

Browse files
committed
DOC: add headings to the column selection include
Easier to see what's happening in each line of code, and make navigation easier.
1 parent ed629c4 commit 22b2475

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,23 @@
11
The same operations are expressed in pandas below. Note that these operations do not happen in
22
place. To make these changes persist, assign the operation back to a variable.
33

4+
Keep certain columns
5+
''''''''''''''''''''
6+
47
.. ipython:: python
58
6-
# keep
79
tips[["sex", "total_bill", "tip"]]
810
9-
# drop
11+
Drop a column
12+
'''''''''''''
13+
14+
.. ipython:: python
15+
1016
tips.drop("sex", axis=1)
1117
12-
# rename
18+
Rename a column
19+
'''''''''''''''
20+
21+
.. ipython:: python
22+
1323
tips.rename(columns={"total_bill": "total_bill_2"})

0 commit comments

Comments
 (0)