code: def min_row_dist_sum_idx(dists):
      
      row_sums = np.apply_along_axis(arr=dists, axis=0, func1d=np.sum)
      return row_sums.argmin()
docs: Find the index of the row with the minimum row distance sum 
  
      This should return the index of the row index with the least distance overall 
      to all other rows. 
  
      Args:
          dists (np.array): must be square distance matrix
  
      Returns:
          int: index of row with min dist row sum