How to remove the first column in a Pandas DataFrame? (with Examples)

There are several easy ways to delete the first column of your Pandas DataFrame. This is specially handy when wrangling your data after acquiring it from an external csv file, database, API etc’.

Delete Python DataFrame first column

Option 1:

You can use the DataFrame drop method:

mydf.drop(columns = 'label_first_column', axis = 1, inplace= True)

Alternatively – using the column index:

mydf.drop(columns = mydf.columns[0], axis = 1, inplace= True)

Option 2:

You can use the iloc accessor, as shown below:

mydf = mydf.iloc[:,1:]

Option 3:

You can use the DataFrame pop method:

mydf = mydf.pop('label_first_column')

Remove first column from DataFrame – Example

Create the DataFrame

We will get started by creating a simple Pandas DataFrame.

import pandas as pd

# define data
month = ['June', 'December', 'May', 'September']
language = ['Scala', 'SQL', 'Go', 'Python']
interviews = (84, 75, 79, 87)
hr = dict(month=month, language=language, interviews=interviews)
hrdf = pd.DataFrame(data=hr)


Here’s our initial DataFrame. We’ll go ahead and show you how to remove the month column.


Drop first column by label

hrdf.drop(columns = 'month', axis = 1, inplace=True)

Note: use the inplace=True parameter to persist your changes to your DataFrame.

Delete first column by index

In this case we pass column index 0 (corresponds to the leftmost column of our data).

hrdf.drop(columns = hrdf.columns[0], axis = 1, inplace=True)

Using the iloc accessor

hrdf = hrdf.iloc[:,1:]

Using the Dataframe pop method


All methods above will provide the same result:


Drop multiple columns by index

What if instead of skipping one column, you would like to drop an arbitrary number of multiple columns? Here we go:

# pass a list of column indices to delete.
cols = hrdf.columns[[0,2]]
hrdf = hrdf.drop(columns = cols)

Delete the index in Pandas DataFrames

You are able to use the set_index DataFrame method, to define one of your columns as the DataFrame index. In this example, we’ll set the language column as index.


Additional Learning