I would like to come up with the 4th column below based on the first three:
user job time Rank
A print 1559 2
A print 1540 2
A edit 1520 1
A edit 1523 1
A deliver 9717 3
B edit 1717 2
B edit 1716 2
B edit 1715 2
B deliver 1527 1
B deliver 1524 1
The ranking in the 4th columns is independent for each user (1st column). For each user, I would like to rank the second column based on the value of the 3rd column. Eg. for user A, s/he has three jobs to be ranks. Because the time value of 'edit' is the smallest and edit the next and deliver the largest, the ranking for the three is edit - 1, print - 2 and deliver -3.
I know I should start with groupby the first column, but somehow cannot figure how to rank the 2nd column based on the 3rd that's different for each row.