title: Filtering duplicate values using groupby
body: <p>I'm reading the documentation to understand the method filter when used with groupby. In order to understand it, I've got the below scenario:</p>
  
  <p>I'm trying to get the duplicate names grouped by city from my DataFrame df. 
  Below is my try:</p>
  
  <pre><code>df = pd.DataFrame({
      'city':['LA','LA','LA','LA','NY', 'NY'],
      'name':['Ana','Pedro','Maria','Maria','Peter','Peter'],
      'age':[24, 27, 19, 34, 31, 20],
      'sex':['F','M','F','F','M', 'M'] })
  
  df_filtered = df.groupby('city').filter(lambda x: len(x['name']) &gt;= 2)
  
  df_filtered
  </code></pre>
  
  <p>The output I'm getting is:</p>
  
  <pre><code>city    name    age sex
  LA      Ana     24  F
  LA      Pedro   27  M
  LA      Maria   19  F
  LA      Maria   34  F
  NY      Peter   31  M
  NY      Peter   20  M
  </code></pre>
  
  <p>The output I'm expecting is:</p>
  
  <pre><code>city    name    age sex
  LA      Maria   19  F
  LA      Maria   34  F
  NY      Peter   31  M
  NY      Peter   20  M
  </code></pre>
  
  <p>It's not clear to me in which cases I have to use different column names in the "groupby" method and in the "len" inside of the "filter" method</p>
  
  <p>Thank you</p>