how to move a specific row to last row in python

Solutions on MaxInterview for how to move a specific row to last row in python by the best coders in the world

showing results for - "how to move a specific row to last row in python"
Clara
11 Jan 2020
1val = '<s>'
2idx = [val] + df.index.drop(val).tolist()
3print (idx)
4['<s>', 'noun', 'verb', 'Adj', '<end>']
5
6print (df.reindex(idx))
7
8       col1  col2  col3
9index                  
10<s>       9     6     5
11noun      1     1     1
12verb      4     6     1
13Adj       5     1     3
14<end>     0     0     0
15
similar questions