Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

drop columns in python pandas

df
	A	B	C	D
0	0	1	2	3
1	4	5	6	7
2	8	9	10	11

df.drop(['B', 'C'], axis=1, inplace=True)
   A   D
0  0   3
1  4   7
2  8  11

df.drop(columns=['B', 'C'], inplace = True)
   A   D
0  0   3
1  4   7
2  8  11
Source by pandas.pydata.org #
 
PREVIOUS NEXT
Tagged: #drop #columns #python #pandas
ADD COMMENT
Topic
Name
1+1 =