I have the following DataFrame (df):
DataFrame
df
import numpy as np import pandas as pd df = pd.DataFrame(np.random.rand(10, 5))
In your case,
df = df.reindex(columns=['mean',0,1,2,3,4])
will do exactly what you want.
In my case (general form):
df = df.reindex(columns=sorted(df.columns)) df = df.reindex(columns=(['opened'] + list([a for a in df.columns if a != 'opened']) ))