How to interpret the result of ranking a series in python?

ipython

#1

I have created a series in Ipython notebook and use rank function to rank them but I am not able to understand how the function ranks the value of a series.

obj = Series([7, -5, 7, 4, 2, 0, 4])
obj.rank()
0 6.5
1 1.0
2 6.5
3 4.5
4 3.0
5 2.0
6 4.5

#2

The rank would be assigned in the following order: -5, 0, 2, 4, 4, 7, 7
Now, the equal numbers are assigned average of their ranks which is the default, You can change this by changing the method parameter. The other values could be

method : {‘average’, ‘min’, ‘max’, ‘first’, ‘dense’}

But here, the rank of 4 is 4 and 5 once each. Thus, the average of 4.5 is assigned to both.
The rank of 7 is 6 and 7, Average is 6.5

Let me know if you have any doubts.