move column position in pandas code example
Example 1: reorder columns pandas
cols = df.columns.tolist()
# Rearrange the list any way you want
cols = cols[-1:] + cols[:-1]
df = df[cols]
Example 2: how to move columns in a dataframen in python
df = df[['column1', 'column2','column3']]