title: How to get centroids from SciPy's hierarchical agglomerative clustering?
body: <p>I am using SciPy's hierarchical agglomerative clustering methods to cluster a m x n matrix of features, but after the clustering is complete, I can't seem to figure out how to get the centroid from the resulting clusters. Below follows my code:</p>
  
  <pre><code>Y = distance.pdist(features)
  Z = hierarchy.linkage(Y, method = "average", metric = "euclidean")
  T = hierarchy.fcluster(Z, 100, criterion = "maxclust")
  </code></pre>
  
  <p>I am taking my matrix of features, computing the euclidean distance between them, and then passing them onto the hierarchical clustering method. From there, I am creating flat clusters, with a maximum of 100 clusters</p>
  
  <p>Now, based on the flat clusters T, how do I get the 1 x n centroid that represents each flat cluster?</p>