def set_column_sequence(dataframe, seq, front=True):
    """Takes a dataframe and a subsequence of its columns,
       returns dataframe with seq as first columns if "front" is True,
       and seq as last columns if "front" is False.
    """
cols = seq[:]
for x in dataframe.columns:
    if x not in cols:
        if front:
            cols.append(x)
else:
    pass
How to rearrange Pandas column sequence?