Dropping all columns after is the same as keeping all columns up to and including. So:
In [321]: df = pd.DataFrame(columns=['A','B','C','D'])In [322]: df = df.loc[:, :'B']In [323]: dfOut[323]: Empty DataFrameColumns: [A, B]Index: []
(Using inplace
is typically not worth it.)