title: Pandas Groupby and Sum Only One Column
body: <p>So I have a dataframe, <code>df1</code>, that looks like the following:</p>
  <pre><code>       A      B      C
  1     foo    12    California
  2     foo    22    California
  3     bar    8     Rhode Island
  4     bar    32    Rhode Island
  5     baz    15    Ohio
  6     baz    26    Ohio
  </code></pre>
  <p>I want to group by column <code>A</code> and then sum column <code>B</code> while keeping the value in column <code>C</code>. Something like this:</p>
  <pre><code>      A       B      C
  1    foo     34    California
  2    bar     40    Rhode Island
  3    baz     41    Ohio
  </code></pre>
  <p>The issue is, when I say</p>
  <pre><code>df.groupby('A').sum()
  </code></pre>
  <p>column <code>C</code> gets removed, returning</p>
  <pre><code>      B
  A
  bar  40
  baz  41
  foo  34
  </code></pre>
  <p>How can I get around this and keep column <code>C</code> when I group and sum?</p>