title: How to copy a selected row from dataframe from existing dataframe on conditional check? [python]
body: <h2>The Scenario</h2>
  
  <p>I have dataframe <code>df1</code> which needs to cutdown into different dataframes based on a list <code>y_km</code>.
  Dataframe <code>df1</code> holds data as follows:</p>
  
  <pre><code>          0         1         2
  0  3.000000  4.000000  3.000000   
  1  3.618555  3.646074  3.923834   
  2  2.669256  2.769302  2.897346
  3  4.340775  4.311200  4.341143
  </code></pre>
  
  <p>and <code>y_km</code> as <code>[0, 3, 2, 1, 2, 3, 3, 3, 1, 1, 0, 1, 2]</code></p>
  
  <h2>My Snippet</h2>
  
  <pre><code>df1 = pd.DataFrame(X)
  df1 = df1.iloc[0:5,:10]
  cl0 = pd.DataFrame()
  cl1 = pd.DataFrame()
  cl2 = pd.DataFrame()
  cl3 = pd.DataFrame()
  
  y_km = list(y_kmeans)
  for i in y_kmeans:
      rows = df1.iloc[i, :]
      if i == 0:
          cl0 = cl0.append(rows, ignore_index=False)
      elif i == 1:
          cl1 = cl1.append(rows, ignore_index=False)
      elif i == 2:
          cl2 = cl2.append(rows, ignore_index=False)
      elif i == 3:
          cl3 = cl3.append(rows, ignore_index=False)
  </code></pre>
  
  <p>Issue with this is, that my clX DFrames are having the same records as of first inserted.</p>