Pandas has reindex method that does it. You just need to give a list with the column names in the order you wish:
columnsTitles=["B","A"]
df=df.reindex(columns=columnsTitles)
In answerQA you can ask and answer questions and share your experience with others!
Pandas has reindex method that does it. You just need to give a list with the column names in the order you wish:
columnsTitles=["B","A"]
df=df.reindex(columns=columnsTitles)