title: Python conditional filtering in csv file
body: <p>Please help! I have tried different things/packages writing a program that takes in 4 inputs and returns the writing score statistics of a group based on those combination of inputs from a csv file. This is my first project, so I would appreciate any insights/hints/tips!</p>
  
  <p>Here is the csv sample (has 200 rows total):</p>
  
  <pre><code>id  gender  ses schtyp  prog        write
  70  male    low public  general     52
  121 female  middle  public  vocation    68
  86  male    high    public  general     33
  141 male    high    public  vocation    63      
  172 male    middle  public  academic    47
  113 male    middle  public  academic    44
  50  male    middle  public  general     59
  11  male    middle  public  academic    34      
  84  male    middle  public  general     57      
  48  male    middle  public  academic    57      
  75  male    middle  public  vocation    60      
  60  male    middle  public  academic    57  
  </code></pre>
  
  <p>Here is what I have so far: </p>
  
  <pre><code>import csv
  import numpy
  csv_file_object=csv.reader(open('scores.csv', 'rU')) #reads file
  header=csv_file_object.next() #skips header
  data=[] #loads data into array for processing
  for row in csv_file_object:
      data.append(row)
  data=numpy.array(data)
  
  #asks for inputs 
  gender=raw_input('Enter gender [male/female]: ')
  schtyp=raw_input('Enter school type [public/private]: ')
  ses=raw_input('Enter socioeconomic status [low/middle/high]: ')
  prog=raw_input('Enter program status [general/vocation/academic: ')
  
  #makes them lower case and strings
  prog=str(prog.lower())
  gender=str(gender.lower())
  schtyp=str(schtyp.lower())
  ses=str(ses.lower())
  </code></pre>
  
  <p>What I am missing is how to filter and gets stats only for a specific group. For example, say I input male, public, middle, and academic -- I'd want to get the average writing score for that subset. I tried the groupby function from pandas, but that only gets you stats for broad groups (such as public vs private). I also tried DataFrame from pandas, but that only gets me filtering for one input and not sure how to get the writing scores. Any hints would be greatly appreciated! </p>