1# create a dataframe
2df = pd.DataFrame({'B':[1,2],'A':[0,0],'C':[1,1]})
3# reorder columns as ['A','B','C']
4df = df.reindex(columns = ['A','B','C'])
1cols = df.columns.tolist()
2cols = cols[-1:] + cols[:-1] #bring last element to 1st position
3df = df.reindex(cols, axis=1)
1cols = df.columns.tolist()
2# Rearrange the list any way you want
3cols = cols[-1:] + cols[:-1]
4df = df[cols]
1You could also do something like this:
2
3df = df[['mean', '0', '1', '2', '3']]
4You can get the list of columns with:
5
6cols = list(df.columns.values)
7The output will produce:
8
9['0', '1', '2', '3', 'mean']