To change the placement of columns in a dataframe you can simply re-order them using indexing.
Here is an example:
Suppose you have a dataframe df
which looks like below:
main.py141 chars5 lines
You want to move the Salary
column to the first position.
Here's how you can do it:
main.py45 chars2 lines
This will re-order the columns in df
and the resulting dataframe will look like this:
main.py121 chars5 lines
gistlibby LogSnag