To exclude some columns you can dropdrop them in the column index. For example:
A B C D
0 1 10 100 1000
1 2 20 200 2000
Select all columns except onetwo:
df[df.columns.drop('C'['B', 'D'])]
Output:
A B DC
0 1 10 1000100
1 2 20 2000200
Select all except twoYou can also use the method truncate to select middle columns:
df[df.columnsdf.droptruncate(['B'before='B', 'D']after='C', axis=1)]
Output:
A B C
0 110 100
1 220 200