title: pandas query rows by list
body: <p>I have a pandas data frame and want to return the rows from the data frame corresponding to the customer ids that appear in a list of target ids.</p>
  
  <p>For example, if my data frame looks like this:</p>
  
  <pre><code>id    Name    ...    ...
  -------------------------
  1     Bob     ...    ...
  2     Dave    ...    ...
  2     Dave    ...    ...
  3     Phil    ...    ...
  4     Rick    ...    ...
  4     Rick    ...    ...
  </code></pre>
  
  <p>Basically I want to return the rows for customers who appear more than once in this data frame. So I want to return all the ids that occur more than once.</p>
  
  <pre><code>id    Name    ...    ...
  -------------------------
  2     Dave    ...    ...
  2     Dave    ...    ...
  4     Rick    ...    ...
  4     Rick    ...    ...
  </code></pre>
  
  <p>I can get a list of the ids by doing the following</p>
  
  <pre><code>grouped_ids = df.groupby('id').size()
  id_list = grouped_ids[grouped_ids&gt;1].index.tolist()
  </code></pre>
  
  <p>And now I'd like to go back to the data frame and return all the rows corresponding to those ids in the list.</p>
  
  <p>Is this possible?</p>
  
  <p>Thanks for the help. </p>