ROBBAT1on Stack Overflow • Recommends
On “move column in pandas dataframe”
You can use to way below. It's very simple, but similar to the good answer given by Charlie Haley.
df1 = df.pop('b') # remove column b and store it in df1
df2 = df.pop('x') # remove column x and store it in df2
df'b'=df1 # add b series as a 'new' column.
df'x'=df2 # add b series as a 'new' column.
Now you have your dataframe with the columns 'b' and 'x' in the end. You can see this video from OSPY : link to this video