title: Python get clustered data-Hierachical Clustering
body: <p>I used following python script to do a hierarchical clustering and print the dendogram. Please consider I'm new to Data-mining.</p>
  
  <pre><code>import numpy as np
  import distance
  import scipy.cluster.hierarchy
  import matplotlib.pyplot as plt
  from scipy.cluster.hierarchy import dendrogram, linkage
  
  mat = np.array([[ 0. , 1. , 3.  ,0. ,2.  ,3.  ,1.],
   [ 1. , 0. , 3. , 1.,  1. , 2. , 2.],
   [ 3.,  3. , 0.,  3. , 3.,  3. , 4.],
   [ 0. , 1. , 3.,  0. , 2. , 3.,  1.],
   [ 2. , 1.,  3. , 2.,  0. , 1.,  3.],
   [ 3. , 2.,  3. , 3. , 1. , 0. , 3.],
   [ 1. , 2.,  4. , 1. , 3.,  3. , 0.]])
  
  linkage_matrix = linkage(mat, "single")
  
  dendrogram(linkage_matrix,
             color_threshold=1,
             truncate_mode='lastp',
             distance_sort='ascending')
  
  plt.show()
  </code></pre>
  
  <p>Following is the dendogram that I have got. I need to print the clusters and the data that belongs to each cluster?</p>
  
  <pre><code>cluster1 4,5
  cluster2 ..,..
  cluster3 ..,..
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/wQQJM.png" alt="enter image description here"></p>