yourdf.drop(['columnheading1', 'columnheading2'], axis=1, inplace=True)
dataframe.drop(['columnname1', 'columnname2'], axis=1, inplace=True)
import pandas as pd
# create a sample dataframe
data = {
'A': ['a1', 'a2', 'a3'],
'B': ['b1', 'b2', 'b3'],
'C': ['c1', 'c2', 'c3'],
'D': ['d1', 'd2', 'd3']
}
df = pd.DataFrame(data)
# print the dataframe
print("Original Dataframe:
")
print(df)
# remove columns C and D
df = df.drop(['C', 'D'], axis=1)
print("
After dropping columns C and D:
")
print(df)