You can use either drop() or iloc to delete column(s) from a dataframe using their indices.
Using iloc
The following code creates a list of column indices 'cols' using the column names. Then it subtracts the column indices 'drop_col' that need to be removed. iloc uses the remaining indices 'i' to return the resulting dataframe.
>>> import pandas as pd
>>> df=pd.DataFrame({'x':['a','b','c'], 'y':['d','e','f'], 'z':['g','h','i']})
>>> df
x y z
0 a d g
1 b e h
2 c f i
>>> cols=[i for i in range(len(df.columns))]
>>> cols
[0, 1, 2]
>>> drop_col=[0,2]
>>> i=list(set(cols).difference(drop_col))
>>> df.iloc[:,i]
y
0 d
1 e
2 f
Using drop()
The drop() function needs column names, not their indices. That's why you are getting the error. You can get all column names using columns and then select the columns that you want to delete using their indices.
Here is an example using the drop() function:
>>> import pandas as pd
>>> df=pd.DataFrame({'x':['a','b','c'], 'y':['d','e','f'], 'z':['g','h','i']})
>>> df
x y z
0 a d g
1 b e h
2 c f i
>>> cols=[i for i in range(len(df.columns))]
>>> cols
[0, 1, 2]
>>> drop_col=[0,2]
>>> df.drop(df.columns[drop_col], axis=1)
y
0 d
1 e
2 f