xxxxxxxxxx
>>> df.drop(['B', 'C'], axis=1)
A D
0 0 3
1 4 7
2 8 11
xxxxxxxxxx
#To delete the column without having to reassign df
df.drop('column_name', axis=1, inplace=True)
xxxxxxxxxx
df.drop('column_name', axis=1, inplace=True)
#no need to reasign df
#axis 1 is columns, 0 is rows
xxxxxxxxxx
df.drop(['Col_1', 'Col_2'], axis = 1) # to drop full colum more general way can visulize easily
df.drop(['Col_1', 'Col_2'], axis = 1, inplace = True) # advanced : to generate df without making copies inside memory
xxxxxxxxxx
#working with "text" syntax for the columns:
df.drop(['column_nameA', 'column_nameB'], axis=1, inplace=True)