Pandas > Reindex

Name
Code
Output
dataframe = pandas.DataFrame(numpy.random.randint(0,10,size=(5, 3)), columns=['C1','C2','C3'])
print ("dataframe")
print (dataframe)
dataframe2 = dataframe.reindex([3,4,1,2,3])
print ("dataframe renamed")
print (dataframe2)
dataframe
   C1  C2  C3
0   4   8   9
1   4   2   1
2   4   9   8
3   3   2   3
4   8   7   5
dataframe renamed
   C1  C2  C3
3   3   2   3
4   8   7   5
1   4   2   1
2   4   9   8
3   3   2   3