code: def find_clusters_1d_hierarchical(vals, t, **kwargs):
      """
      Find clusters in <vals> using hierarchical clustering with parameter <t>. Further parameters need to be passed via
      <kwargs>. Uses *fclusterdata* from *scipy.cluster.hierarchy*.
      """
      from scipy.cluster.hierarchy import fclusterdata
  
      data = vals.reshape((len(vals), 1))
      ind = fclusterdata(data, t, **kwargs)
  
      clusters = [np.where(ind == c_id)[0] for c_id in np.unique(ind)]
  
      assert len(vals) == sum(map(len, clusters))
  
      return clusters
  
file_path: pdftabextract/pdftabextract/clustering.py
imports: import itertools
  import numpy
  from scipy.stats import chisquare
  from pdftabextract import logger
  from pdftabextract.common import fill_array_a_with_values_from_b, sorted_by_attr, flatten_list, update_text_dict_dim, DIRECTION_HORIZONTAL, DIRECTION_VERTICAL
label_desc: Use image node_id 2 for calling a global function with example usage: find_clusters_1d_hierarchical(vals, t) and returns: clusters