Eng.Mido
0
Q:

how to delete a column from a dataframe in python

df.drop('column_name', axis=1, inplace=True)
1
df = df.drop(df.columns[[0, 1, 3]], axis=1)
1
df = df.drop(df.columns[[0, 1, 3]], axis=1)  # df.columns is zero-based pd.Index 
df.drop(['column_nameA', 'column_nameB'], axis=1, inplace=True)
0
del df['column']
1
del df['column_name'] #to remove a column from dataframe
0
del df['column_name']
0
del df['column_name']
0

New to Communities?

Join the community