Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

delete columns pandas

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)
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #delete #columns #pandas
ADD COMMENT
Topic
Name
7+6 =