title: python code to find feature importances after kmeans clustering
body: <p>I researched the ways to find the feature importances (my dataset just has 9 features).Following are the two methods to do so, But i am having difficulty to write the python code.</p>
  
  <p>I am looking to rank each of the features who's influencing the cluster formation. </p>
  
  <ol>
  <li><p>Calculate the variance of the centroids for every dimension. The dimensions with the highest variance are most important in distinguishing the clusters.</p></li>
  <li><p>If you have only a little number of variables you could do some kind of leaving-one-out test (remove 1 var and redo clustering). Also keep in mind that k-means depends on the initialization, so you want to keep that fixed when you redo the clustering.</p></li>
  </ol>
  
  <p>Any python codes to accomplish this?</p>