Categories
Python Answers

How to delete a column from a Python Pandas DataFrame?

Spread the love

To delete a column from a Python Pandas DataFrame, we call the drop method.

For instance, we write

df = df.drop('column_name', 1)

to call df.drop to drop the column_name column only.

The 1 indicates we drop only the column in the 1st argument.

Leave a Reply

Your email address will not be published.

If you like the content of this blog, subscribe to my email list to get exclusive articles not available to anyone else.