Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

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
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #move #specific #row #row #python
ADD COMMENT
Topic
Name
2+3 =