pandas has reindex method that does it. You just need to give a list with the column names in the order you wish:
columns_titles = ["B","A"]
df=df.reindex(columns=columns_titles)
Cheers
pandas has reindex method that does it. You just need to give a list with the column names in the order you wish:
columns_titles = ["B","A"]
df=df.reindex(columns=columns_titles)
Cheers