code: def _rankdata(a, method="average"):
      """Assign ranks to data, dealing with ties appropriately.
  
      Ranks begin at 1. The method argument controls how ranks are assigned
      to equal values.
  
      Parameters
      ----------
      a : array_like
          The array of values to be ranked. The array is first flattened.
  
      method : str, optional
          The method used to assign ranks to tied elements.
          The options are 'max'.
          'max': The maximum of the ranks that would have been assigned
                to all the tied values is assigned to each value.
  
      Returns
      -------
      ranks : ndarray
          An array of length equal to the size of a, containing rank scores.
  
      Notes
      -----
      We only backport the 'max' method
  
      """
      if method != "max":
          raise NotImplementedError()
  
      unique_all, inverse = np.unique(a, return_inverse=True)
      count = bincount(inverse, minlength=unique_all.size)
      cum_count = count.cumsum()
      rank = cum_count[inverse]
      return rank
  
imports: import numpy
  from scipy.stats import rankdata
  from .fixes import bincount
label_desc: Use image node_id 1 for calling a global function with example usage: _rankdata(a, method) and returns: rank