your example works fine.
df.drop(df.columns[[0, 1, 3]], axis=1)
sometimes you'll see it like this:
df.drop(df.columns[[0, 1, 3]], inplace=True, axis=1)
Another way to accomplish this would be by typing the names of the column headers:
df.drop(['column 1', 'column 2', 'column name 3'], axis=1)
However, it is good practice to create a new data frame when dropping columns. If you run that cell again, you'll get errors.
df_dropped = df.drop(['column 1', 'column 2', 'column name 3'], axis=1)
To answer your question about axis=1, it's the column headers.
column 1 |
column 2 |
column name 3 |
12 |
34 |
44 |
99 |
42 |
33 |