
Problem –
You want to select all columns except one in pandas.
Solution –
To select all column except the one column in pandas you can use the drop method in pandas.
Let’s read a dataset to illustrate it.
import pandas as pd
url = 'https://raw.githubusercontent.com/bprasad26/lwd/master/data/clothing_store_sales.csv'
df = pd.read_csv(url)
df.head()

Let’s say I want to select all the columns except the Age column. For that I will write.
df_new = df.drop('Age', axis=1)

IF you are not interested to create a new dataframe then you can use drop like this.
df[df.columns.drop('Age')]
