First I would add a new column using
df['new'] = df.index
than reading the column names of your data frame in a list with:
colnames = df.columns.tolist()
Then you can change them as you need, for example, change the order so that you get the last βnewβ column as the first and move the rest of the position to the right:
colnames = colnames[-1:] + colnames[:-1]
and reassign:
df = df[colnames]
source share