The best way to do this in Pandas is to use drop:

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

where 1 is the axis number (0 for rows and 1 for columns.)

Or, the drop() method accepts index/columns keywords as an alternative to specifying the axis. So we can now just do:

df = df.drop(columns=['column_nameA', 'column_nameB'])
  • This was introduced in v0.21.0 (October 27, 2017)

To delete the column without having to reassign df you can do:

df.drop('column_name', axis=1, inplace=True)

Finally, to drop by column number instead of by column label, try this to delete, e.g. the 1st, 2nd and 4th columns:

df = df.drop(df.columns[[0, 1, 3]], axis=1)  # df.columns is zero-based pd.Index

Also working with "text" syntax for the columns:

df.drop(['column_nameA', 'column_nameB'], axis=1, inplace=True)
Answer from LondonRob on Stack Overflow
🌐
Data Science Discovery
discovery.cs.illinois.edu › guides › Modifying-DataFrames › removing-columns-from-dataframes
Removing Columns in a DataFrame - Data Science Discovery
August 8, 2022 - We can remove columns with one simple function: df.drop(). All you need to do is type the name of the column you want to get rid of in the parenthesis. Remember to put quotes around the column name and store the results in a new variable to ...
🌐
MLJAR
mljar.com › docs › pandas-delete-column
Delete Column in Pandas DataFrame
Use drop() function from Pandas package to delete column in DataFrame. You can drop single column or multiple columns at once.
🌐
W3Schools
w3schools.com › python › pandas › ref_df_drop.asp
Pandas DataFrame drop() Method
dataframe.drop(labels, axis, index, columns, level, inplace., errors)
🌐
Medium
medium.com › @whyamit404 › how-to-drop-a-column-in-pandas-d98171134a1d
How to Drop a Column in Pandas?
February 26, 2025 - Drop all-NaN columns? dropna(axis=1, how='all'). Pattern-based drops? Combine filter() with drop(). I hope this clears things up! If you’ve got more questions, keep them coming. Data doesn’t clean itself — but with pandas, it almost feels like it does.
Find elsewhere
🌐
GeeksforGeeks
geeksforgeeks.org › python › pandas-drop-column
Pandas Drop Column - GeeksforGeeks
July 23, 2025 - When working with large datasets, there are often columns that are irrelevant or redundant. Pandas provides an efficient way to remove these unnecessary columns using the `drop()` function.
🌐
GitHub
github.com › pandas-dev › pandas › issues › 14616
Feature Request: Keep only these columns (vs. dropping all the ones you don't want) · Issue #14616 · pandas-dev/pandas
November 8, 2016 - The idea is that instead of specifying all of the columns that you wish to delete from a DataFrame via the .drop method, you specify instead the columns you wish to keep through a .keep_cols method - all other columns are deleted. This would save typing in cases where there are many columns, and we only want to keep a small subset of columns. The prime use case here is method chaining, where using [[ doesn't really work in the middle of many methods being chained together. import pandas as pd # Create an example DataFrame data = [ [1, 'ABC', 4, 10, 6.3], [2, 'BCD', 10, 9, 11.6], [3, 'CDE', 7,
Author   pandas-dev
🌐
Educative
educative.io › answers › how-to-delete-a-column-in-pandas
How to delete a column in pandas
line 7 shows how to drop a column by calling drop. inplace=True means the operation would work on the original object. axis=1 means we are dropping the column, not the row. You can compare the output of line 6 and line 9. del is also an option, you can delete a column by del df['column name']. The Python would map this operation to df.__delitem__('column name'), which is an internal method of DataFrame. import pandas as pd ·
🌐
freeCodeCamp
freecodecamp.org › news › dataframe-drop-column-in-pandas-how-to-remove-columns-from-dataframes
Dataframe Drop Column in Pandas – How to Remove Columns from Dataframes
March 27, 2023 - To remove two or more columns from a DataFrame using the .drop() method in Pandas, we can pass a list of column names to the columns parameter of the method.
🌐
Sentry
sentry.io › sentry answers › python › delete a column from a dataframe in python pandas
Delete a column from a DataFrame in Python Pandas | Sentry
June 15, 2023 - How do I delete a column from a Pandas DataFrame? We can do this using the DataFrame.drop method: import pandas # DataFrame with three columns products = pandas.DataFrame([["apple", 1, 2], ["orange", 3, 4], ["pear", 5, 6]], columns=["product", "cost_price", "sale_price"]) print(products) # Remove the sale_price column products.drop('sale_price', axis=1, inplace=True) print(products) This code will print the products DataFrame with three columns and then with two columns.
🌐
Sparrow Computing
sparrow.dev › home › blog › dropping columns and rows in pandas
Dropping Columns and Rows in Pandas - Sparrow Computing
October 15, 2021 - The easiest way to drop rows and columns from a Pandas DataFrame is with the .drop() method, which accepts one or more labels passed in as index=<rows to drop> and/or columns=<cols to drop>:
🌐
Reddit
reddit.com › r/learnpython › dropped columns reappearing in pandas
r/learnpython on Reddit: Dropped Columns Reappearing in Pandas
June 8, 2021 -
df.columns = df.columns.str.replace(r"\(.*\)","") #Parathesis contain no useful data; delete all values with parathesis
df.columns = df.columns.str.replace(".","") #Periods waste space
df.columns = df.columns.str.replace(" ","") #Spaces waste space and complicate code
df.columns = df.columns.str.replace("/","") #forwardslashes waste space and complicate code
df.columns = df.columns.str.replace("Province","") #there are no providences in our data we just call them states anyways
df.columns = df.columns.str.replace("PostalCode","") #we are calling it zip for space
df.columns = df.columns.str.replace("PotentialCustomer", "customer") #shortening to save space
df.columns = df.columns.str.replace("LineOfBusiness", "industry") #shorten to one word
df.columns = df.columns.str.replace("TotalDealRevenue", "estrev") #replace long bad description with short good one
df.columns = df.columns.str.replace("ActualRevenue", "actrev") #shorten to 6 char

df.columns = map(str.lower, df.columns) #all char lowercase for simplicity

df.drop(columns=['opportunity', 'rowchecksum', 'modifiedon', 'dealname',
         'probability', 'createdon', 'owner', 'email', 'payterms', 'project', 
         'certificateofinsurance', 'commissionform', 'equipmentrep', 'rentalrep', 'accountsterms'])

So the output has all the columns except for the ones that I have dropped. However when I enter

df.head(5)

I am getting output of all columns including the ones that were supposedly dropped.

🌐
Flexiple
flexiple.com › python › dataframe-drop-column-in-pandas
Dataframe Drop Column in Pandas - How to Remove Columns from Dataframes - Flexiple
February 21, 2024 - To drop a column in Pandas DataFrame, you simply need to call the drop() function and pass the name of the column you wish to remove along with the axis parameter set to 1, indicating that you're dropping a column.
🌐
GitHub
github.com › joeyajames › Python › blob › master › Pandas › Pandas - Delete Columns from DataFrame.ipynb
Python/Pandas/Pandas - Delete Columns from DataFrame.ipynb at master · joeyajames/Python
"# Pandas - Delete Columns from a DataFrame" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "import pandas as pd" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "data": { "text/html": [ "<div>\n", "<style scoped>\n", " .dataframe tbody tr th:only-of-type {\n", " vertical-align: middle;\n", " }\n", "\n", " .dataframe tbody tr th {\n", " vertical-align: top;\n", " }\n",
Author   joeyajames
🌐
Arab Psychology
scales.arabpsychology.com › home › how to easily drop multiple columns in pandas
How To Easily Drop Multiple Columns In Pandas
November 21, 2025 - The drop() function is arguably the most utilized tool for removing data components within a Pandas structure. Its signature flexibility comes from its ability to handle both rows and columns based on the axis parameter.
🌐
Kanaries
docs.kanaries.net › topics › Python › dataframe-drop-column
How to Drop a Column in Pandas DataFrame – Kanaries
August 17, 2023 - You can also remove columns based on some conditions using the drop method. For example, you can remove all columns that have all NaN values. # create a sample DataFrame with a column having all NaN values import pandas as pd import numpy as np data = {'name': ['Alex', 'Bob', 'Clarke', 'David'], 'age': [20, 25, 19, 18],'city': [np.nan, np.nan, np.nan, np.nan], 'occupation': ['Engineer', 'Doctor', 'Artist', 'Lawyer']} df = pd.DataFrame(data) # delete the columns that have all NaN values df = df.dropna(how='all', axis=1) print(df.head())