move columns in pandas dataframe code example
Example 1: how to change the column order in pandas dataframe
df = df.reindex(columns=column_names)
Example 2: how to move columns in a dataframen in python
df = df[['column1', 'column2','column3']]
Example 3: pandas move columns around
df = df[['a', 'y', 'b', 'x']]