1# Let df be a dataframe
2# Let new_df be a dataframe after dropping a column
3
4new_df = df.drop(labels='column_name', axis=1)
5
6# Or if you don't want to change the name of the dataframe
7df = df.drop(labels='column_name', axis=1)
8
9# Or to remove several columns
10df = df.drop(['list_of_column_names'], axis=1)
11
12# axis=0 for 'rows' and axis=1 for columns1# axis=1 tells Python that we want to apply function on columns instead of rows
2# To delete the column permanently from original dataframe df, we can use the option inplace=True
3df.drop(['A', 'B', 'C'], axis=1, inplace=True)1>>>df = pd.DataFrame(np.arange(12).reshape(3, 4), 
2                     columns=['A', 'B', 'C', 'D'])
3>>>df
4   A  B   C   D
50  0  1   2   3
61  4  5   6   7
72  8  9  10  11
8
9>>> df.drop(['B', 'C'], axis=1)
10   A   D
110  0   3
121  4   7
132  8  11
14
15OR
16
17>>> df.drop(columns=['B', 'C'])
18   A   D
190  0   3
201  4   7
212  8  11