I have the following DataFrame (df):
DataFrame
df
import numpy as np import pandas as pd df = pd.DataFrame(np.random.rand(10, 5))
You could do the following (borrowing parts from Aman's answer):
cols = df.columns.tolist() cols.insert(0, cols.pop(-1)) cols >>>['mean', 0L, 1L, 2L, 3L, 4L] df = df[cols]