title: Pandas groupby and filter
body: <p>I have dataframe:</p>
  
  <pre><code>df = pd.DataFrame({'ID':[1,1,2,2,3,3], 
                     'YEAR' : [2011,2012,2012,2013,2013,2014], 
                     'V': [0,1,1,0,1,0],
                     'C':[00,11,22,33,44,55]})
  </code></pre>
  
  <p>I would like to group by ID, and select the row with V = 0 within each group. </p>
  
  <p>This doesn't seem to work:</p>
  
  <pre><code>print(df.groupby(['ID']).filter(lambda x: x['V'] == 0)) 
  </code></pre>
  
  <p>Got an error:</p>
  
  <blockquote>
    <p>TypeError: filter function returned a Series, but expected a scalar bool</p>
  </blockquote>
  
  <p>How can I use filter to achieve the goal? Thank you.</p>
  
  <p><strong>EDIT</strong>:
  The condition on V may vary for each group, e.g., it could be V==0 for ID 1, V==1 for ID 2, and this info can be available through another DF:</p>
  
  <pre><code>df = pd.DataFrame({'ID':[1,2,3], 
                     'V': [0,1,0])
  </code></pre>
  
  <p>So how to do row filtering within each group?</p>