How to rearrange the data of series in python?



I have created a series in python

In [79]: obj = Series([4.5, 7.2, -5.3, 3.6], index=['d', 'b', 'a', 'c'])
In [80]: obj
d 4.5
b 7.2
a -5.3
c 3.6

I want to know is there a function by which we can rearrange the data according to index for example a index value should come to top and d index value come to third and remaining index value should remain to their respective values.


@sid100158 - You can use the reindex function for reindexing the index of a series in python.

Hope this helps!