Tutorials References Menu

Pandas DataFrame pop() Method

❮ DataFrame Reference


Example

Remove the "age" column from the DataFrame:

import pandas as pd

data = {
  "name": ["Sally", "Mary", "John"],
  "age": [50, 40, 30],
  "qualified": [True, False, False]
}

df = pd.DataFrame(data)

#Remove column:

df.pop('age')

print(df)
Try it Yourself »

Definition and Usage

The pop() method removes the specified column from the DataFrame.

The pop() method returns the removed columns as a Pandas Series object.


Syntax

dataframe.pop(label)

Parameters

Parameter Description
label Required. The label of the column to remove.


Return Value

The removed column, as a Pandas Series object.


❮ DataFrame Reference