title: Assign points to cluster centers in 3 dimensions
body: <p>I have a 600x3 dataframe as follows:</p>
  
  <pre><code> X1        X2        X3
  0  0.049150  0.270032  0.577858
  1  0.602387  0.065492  0.555747
  2  0.598355  0.235002  0.482744
  3  0.522151  0.253991  0.402630
  4  0.402601  0.206630  0.553987
  ...
  </code></pre>
  
  <p>Where each row indicates one three dimensional point. I have written a clustering algorithm to find three cluster centers, which have been iteratively "stacked" on top of each other in an array using np.vstack.</p>
  
  <p>accepted_centroids:</p>
  
  <pre><code>[[ 0.5143811   0.41417482  0.5457288 ]
   [ 0.8176921   0.80723679  0.19689465]
   [ 0.12582636  0.65756533  0.80770862]]
  </code></pre>
  
  <p>I also have the indices for each of these centers saved: 
  accepted_indices:</p>
  
  <pre><code>[ 26 420 241]
  </code></pre>
  
  <p>I now want to assign every point in the dataframe to one of these clusters, based on the minimum "l2 norm" distance. I have computed the distance between these clusters and the rest of the points using:</p>
  
  <pre><code>diffy1 = df.iloc[0:].apply(lambda x: np.sqrt(sum((df.iloc[accepted_indices[0]]-x)**2)), axis=1).values
  diffy2 = df.iloc[0:].apply(lambda x: np.sqrt(sum((df.iloc[accepted_indices[1]]-x)**2)), axis=1).values
  diffy3 = df.iloc[0:].apply(lambda x: np.sqrt(sum((df.iloc[accepted_indices[2]]-x)**2)), axis=1).values
  </code></pre>
  
  <p>Each of which outputs a 600x1 vectors of distances. My goal now is to take the first value in each of these three vectors, find the minimum of those three, and then assign the data point to the corresponding cluster. This is where I've run out of ideas so to speak. Hopefully the objective here is clear!</p>
  
  <p>Note: I am not using the K-means algorithm, so those packages do not apply. I am essentially looking to do the "labelling" part of kmeans, and then plot the points, colored based on their labels. </p>