title: Pythonic way to iterate over a Dataframe when column row value matches condition
body: <p>I want to plot a density graph and need to extract two values from the data to use as coordinates and a third value which will be the density value. I have a text file that I want to read and when one row/column value matches a condition I want to save two other values of that row. I have something that works for one of the conditions but it saves the row values within a nested list, I was wondering if there was a more pythonic way to do this as I think it may be easier to plot later.</p>
  <p><em><strong>Data:</strong></em></p>
  <pre><code>Accum   EdgeThr NumberOfBlobs   durationMin Vol Perom   X   Y
  50  0   0   0.03    0   0   0   0
  50  2   0   0.03    0   0   0   0
  50  4   0   0.03    0   0   0   0
  50  6   0   0.03    0   0   0   0
  50  8   2   0.03    27.833133599054975  0.0 1032.0  928.0
  50  10  2   0.03    27.833133599054975  0.0 1032.0  928.0
  46  30  2   0.17    27.833133599054975  0.0 968.0   962.0
  46  32  2   0.17    27.833133599054975  0.0 1028.0  1020.0
  46  34  2   0.17    27.833133599054975  0.0 978.0   1122.0
  46  36  2   0.17    27.833133599054975  0.0 1000.0  1080.0
  46  38  2   0.18    27.833133599054975  0.0 1010.0  1062.0
  </code></pre>
  <p><em><strong>Code:</strong></em></p>
  <pre><code>import pandas as pd
  
  # load data as a pandas dataframe
  df = pd.read_csv('dummy.txt', sep='\t', lineterminator='\r')
  
  # to find the rows matching one condition ==2
  blob2 = []
  for index, row in df.iterrows():
      temp = [row['Accum'], row['EdgeThr']]
      if row['NumberOfBlobs']==2:
          blob2.append(temp)
          print(index, row['Accum'], row['EdgeThr'], row['NumberOfBlobs'])
  print(blob2)
  </code></pre>