how to remove columns in python dataframe code example
Example 1: python code to drop columns from dataframe
new_df = df.drop(labels='column_name', axis=1)
df = df.drop(labels='column_name', axis=1)
df = df.drop(['list_of_column_names'], axis=1)
Example 2: how to delete a column from a dataframe in python
del df['column']
Example 3: delete column in dataframe pandas
df = df.drop(df.columns[[0, 1, 3]], axis=1)
Example 4: how to delete a column in pandas dataframe
delete column from pandas data frame