There is rankdatafunction inside scipy which solves the named problem:
result = rankdata(array)However, one can easily implement this is numpy (isn't beautiful?):
result = numpy.argsort(numpy.argsort(array))which is (almost) equivalent code.
See also my previous post on numpy tricks
PS. Once upon a time I will understand why all blogging platforms suggest heavy and ugly layout templates. Even adding background image turns into non-trivial task.