title: Collapsing rows in a Pandas dataframe
body: <p>I'm trying to collapse rows in a dataframe that contains a column of ID data and a number of columns that each hold a different string. It looks like groupby is the solution, but it seems to be slanted towards performing some numeric function on the group - I just want to keep the text. Here's what I've got...</p>
  
  <p>I have a dataframe of the form:</p>
  
  <pre><code>index    ID     apples    pears    oranges
  0        101                       oranges
  1        134    apples
  2        576              pears
  3        837    apples
  4        576                       oranges
  5        134              pears
  </code></pre>
  
  <p>The columns are clean: so the apples column will only ever have the text "apples" in it, or it will be blank".</p>
  
  <p>Where there are multiple entries under the same ID (in this example, on IDs 134 &amp; 576), I want to collapse the rows together to get this:</p>
  
  <pre><code>index    ID     apples    pears    oranges
  0        101                       oranges
  1        134    apples    pears
  2        576              pears    oranges
  3        837    apples
  </code></pre>
  
  <p>I could do this by iterating over the rows, but it seems like a non-pandas solution. Is there a better way?</p>