# get the column names and move the last column to the front cols = list(df.columns) cols = [cols[-1]] + cols[:-1] # reindex the dataframe with the new column order df = df.reindex(columns=cols)
# get the column names and move the last column to the front cols = list(df.columns) cols = [cols[-1]] + cols[:-1] # reindex the dataframe with the new column order df = df.reindex(columns=cols)