I am trying to drop a column from a pandas dataframe as follows:
df = pd.read_csv('Caravan_Dataset.csv')
X = df.drop('Purchase',axis=1)
y = df['Purchase']
but it does not work. I also tried the following one:
df = pd.read_csv('Caravan_Dataset.csv')
X = df.drop('Purchase',axis=1,inplace=True)
y = df['Purchase']
but it does not work neither. ıt keeps giving an error like Purchase is still on the columns. Any idea about how can I do it?