title: Filter by variable pandas
body: <p>I'd like to write a function that filters a <code>DataFrame</code> by function inputs. My first attempt here is:</p>
  
  <pre><code>def Breakdown(file, key = None, value = None):
      if key is not None:
          if sampreach in ['s', 'S', 'sample', 'Sample']:
              sampreach = sample[sample.key in [value]]
              CountName = 'Total Count'
          elif sampreach in ['r', 'R', 'reachable', 'Reachable']:
              sampreach = reachable[reachable.key in [value]]
              CountName = 'Reachable Count'
      else:
          if sampreach in ['s', 'S', 'sample', 'Sample']:
              sampreach = sample
              CountName = 'Total Count'
          elif sampreach in ['r', 'R', 'reachable', 'Reachable']:
              sampreach = reachable
              CountName = 'Reachable Count'
  </code></pre>
  
  <p>But I got the following error: </p>
  
  <pre><code>AttributeError: 'DataFrame' object has no attribute 'key'
  </code></pre>
  
  <p>The goal is to be able to set <code>key</code> equal to the name of a column header and <code>value</code> as the name of a value to filter to, or better yet a range of values to filter to. </p>
  
  <p>Thanks in advance for the help!</p>