1df = pd.DataFrame(np.arange(12).reshape(3, 4),
2... columns=['A', 'B', 'C', 'D'])
3>>> df
4 A B C D
50 0 1 2 3
61 4 5 6 7
72 8 9 10 11
8
9Drop columns
10>>> df.drop(['B', 'C'], axis=1)
11 A D
120 0 3
131 4 7
142 8 11
15>>> df.drop(columns=['B', 'C'])
16 A D
170 0 3
181 4 7
192 8 11
1df = df.drop(df.columns[[0, 1, 3]], axis=1) # df.columns is zero-based pd.Index
1# pandas drop a column with drop function
2gapminder_ocean.drop(['pop'], axis=1)
3