title: Python - filter column from a .dat file and return a given value from other columns
body: <p>I'm new to Python and been practicing with sample data I created (150 rows) of student ID numbers, grades, age, class_code, area_code, etc. What I'm trying to do with the data is not only filtered by a certain column (by grade, age, etc), but then to also create a list of a different column from that row (student ID). I've manged to find how to isolate the column I need to find the certain value by, but then can't figure out how to create that list of the values I need to return.</p>
  
  <p>So here's a sample of 5 rows of the data:</p>
  
  <pre><code>1/A/15/13/43214
  2/I/15/21/58322
  3/C/17/89/68470
  4/I/18/6/57362
  5/I/14/4/00000
  6/A/16/23/34567
  </code></pre>
  
  <p>I need a list of the 1st column (student ID), based on filtering the second column (grade)...(and eventually the 3rd column, 4th column, etc. But if I see how it looks with just the 2nd, I think I can figure out the others) Also note: I didn't use headers in the .dat file.</p>
  
  <p>I figured out how to isolate/view the 2nd column.</p>
  
  <pre><code>import numpy
  
  data = numpy.genfromtxt('/testdata.dat', delimiter='/', dtype='unicode')
  
  grades = data[:,1]
  print (grades)
  </code></pre>
  
  <p>to print:</p>
  
  <pre><code>['A' 'I' 'C' 'I' 'I' 'A']
  </code></pre>
  
  <p>But now, how can I pull just the first column's that correspond to the A's, C's, I's into separate  lists?</p>
  
  <p>So I'd want to see a list, also with the commas between the integers of column 1 for the A's, C's, and I's</p>
  
  <pre><code>list from A = [1, 6]
  list from C = [3]
  list from I = [2, 4, 5]
  </code></pre>
  
  <p>Again, if I can just see how it's done with just the 2nd column, with just one of the values (say A's), I think I could figure out how to do it for B's, C's, D's, etc and probably the other columns. I just need to see one example to how the syntax would be applied and then like to play around with the rest. </p>
  
  <p>Also, I've been using numpy, but also read about panda, csv and I think those libraries could be possibilities too. But like I said, been using numpy for the .dat files. I don't know if the other libraries would be easier to use?</p>