Scipy rankdata reverse highest to lowest
Possible a stupid answer you don't want, but can't you just subtract the length, i.e., 'reverse' from high to low rank?
a = [1,2,3,4,3,2,3,4]
len(a) - rankdata(a).astype(int)
array([7, 6, 3, 1, 3, 6, 3, 1])
An alternative would be turning the list into negative numbers:
>>> from scipy.stats import rankdata
>>> a = [1,2,3,4,3,2,3,4]
>>> rankdata([-1 * i for i in a]).astype(int)
array([8, 6, 4, 1, 4, 6, 4, 1])
I find this a more accurate approach, since the resolution of the ties is resolved in the sense of the inverted rank, and not in the sense of the natural rank. Additionally, in this case the smallest value gets the value of the last position of the list, as generally expected.