21

For a given data frame:

UUT                  testa  testb  testc  testd
DateTime                                
2017-11-21 18:47:29    1.0    1.0    1.0    3.0
2017-11-21 18:47:30    1.0    2.0    1.0    4.0
2017-11-21 18:47:31    1.0    2.0    5.0    2.0
2017-11-21 18:47:32    1.0    2.0    5.0    1.0
2017-11-21 18:47:33    1.0    2.0    5.0    4.0
2017-11-21 18:47:34    1.0    2.0    5.0    1.0

how can I manually rearrange the columns anyway I want it for example if I want to the following sequence:

testc, testd, testa, testb

So the table and the plot will be in this way:

UUT                  testc  testd  testa  testb  
DateTime                                         
2017-11-21 18:47:29    1.0    3.0    1.0    1.0  
2017-11-21 18:47:30    1.0    4.0    1.0    2.0  
2017-11-21 18:47:31    5.0    2.0    1.0    2.0  
2017-11-21 18:47:32    5.0    1.0    1.0    2.0  
2017-11-21 18:47:33    5.0    4.0    1.0    2.0  
2017-11-21 18:47:34    5.0    1.0    1.0    2.0
2

1 Answer 1

12

You can use:

df = df.reindex_axis(['testc','testd', 'testa','testb'], axis=1)
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.