Skip to content

Latest commit

 

History

History
23 lines (14 loc) · 466 Bytes

column_selection.rst

File metadata and controls

23 lines (14 loc) · 466 Bytes

The same operations are expressed in pandas below. Note that these operations do not happen in place. To make these changes persist, assign the operation back to a variable.

Keep certain columns

.. ipython:: python

   tips[["sex", "total_bill", "tip"]]

Drop a column

.. ipython:: python

   tips.drop("sex", axis=1)

Rename a column

.. ipython:: python

   tips.rename(columns={"total_bill": "total_bill_2"})