For example, I have a pandas dataframe like this :
T2 T4 T3 T1 Time
1 0.1 0.7 0.6 0.2 18:00
2 0.3 0.4 0.1 0.4 16:00
3 0.2 0.3 0.2 0.9 20:00
4 0.1 0.7 0.5 0.4 19:00
5 0.1 0.4 0.8 0.9 17:00
If I have a list :
column_order = ["T1","T2","T3","T4","Time"]
How do I reorder the pandas dataframe to this by given column_order
:
T1 T2 T3 T4 Time
1 0.2 0.1 0.6 0.7 18:00
2 0.4 0.3 0.1 0.4 16:00
3 0.9 0.2 0.2 0.3 20:00
4 0.4 0.1 0.5 0.7 19:00
5 0.9 0.1 0.8 0.4 17:00
I have done some research this and this but none of them mention how to reorder pandas dataframe column by given column name order.
Thanks in advance.