Skip to main content
Question
Matlab
Adam Leo
The smart thing to do once wealthy: Keeping a low profile.
Asked a question last year

how to swap columns in matlab?

Where am I?

In answerQA you can ask and answer questions and share your experience with others!

Christian
"The only way to do great work is to love what you do. If you haven't fount it yet, keep looking. Don't Settle,"

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)