code: def group_min(groups, data):
      
      # sort with major key groups, minor key data
      order = np.lexsort((data, groups))
      groups = groups[order]  # this is only needed if groups is unsorted
      data = data[order]
      # construct an index which marks borders between groups
      index = np.empty(len(groups), 'bool')
      index[0] = True
      index[1:] = groups[1:] != groups[:-1]
      return data[index]
docs: Given a list of groups, find the minimum element of data within each group
  
      Parameters
      -----------
      groups : (n,) sequence of (q,) int
          Indexes of each group corresponding to each element in data
      data : (m,)
          The data that groups indexes reference
  
      Returns
      -----------
      minimums : (n,)
          Minimum value of data per group