Answers for "how to move the last column to the first column in pandas"

0

how to move the last column to the first column in pandas

cols = [df.columns[-1]] + [col for col in df if col != df.columns[-1]]
df = df[cols]
Posted by: Guest on April-26-2022

Code answers related to "how to move the last column to the first column in pandas"

Python Answers by Framework

Browse Popular Code Answers by Language