Ranking of numpy array with possible duplicates,"np.cumsum(np.concatenate(([0], np.bincount(v))))[v]"