Answers for "how to move a specific row to last row in python"

0

how to move a specific row to last row in python

val = '<s>'
idx = [val] + df.index.drop(val).tolist()
print (idx)
['<s>', 'noun', 'verb', 'Adj', '<end>']

print (df.reindex(idx))

       col1  col2  col3
index                  
<s>       9     6     5
noun      1     1     1
verb      4     6     1
Adj       5     1     3
<end>     0     0     0
Posted by: Guest on August-19-2021

Code answers related to "how to move a specific row to last row in python"

Python Answers by Framework

Browse Popular Code Answers by Language