code: def compute_ranks(x):
      
      assert x.ndim == 1
      ranks = np.empty(len(x), dtype=int)
      ranks[x.argsort()] = np.arange(len(x))
      return ranks
docs: Returns ranks in [0, len(x))
  
      Note: This is different from scipy.stats.rankdata, which returns ranks in
      [1, len(x)].