title: Sum grouped Pandas dataframe by single column
body: <p>I have a Pandas dataframe:</p>
  
  <pre><code>test=pd.DataFrame(columns=['GroupID','Sample','SampleMeta','Value'])
  test.loc[0,:]='1','S1','S1_meta',1
  test.loc[1,:]='1','S1','S1_meta',1
  test.loc[2,:]='2','S2','S2_meta',1
  </code></pre>
  
  <p>I want to (1) group by two columns ('GroupID' and 'Sample'), (2) sum 'Value' per group, and (3) retain only unique values in 'SampleMeta' per group. The desired result ('GroupID' and 'Sample' as index) is shown:</p>
  
  <pre><code>                SampleMeta  Value
  GroupID Sample                       
  1       S1      S1_meta      2
  2       S2      S2_meta      1 
  </code></pre>
  
  <p>df.groupby() and the .sum() method get close, but .sum() concatenates identical values in the 'Values' column within a group. As a result, the 'S1_meta' value is duplicated.</p>
  
  <pre><code>g=test.groupby(['GroupID','Sample'])
  print g.sum()
  
                  SampleMeta      Value
  GroupID Sample                       
  1       S1      S1_metaS1_meta  2
  2       S2      S2_meta         1 
  </code></pre>
  
  <p>Is there a way to achieve the desired result using groupby() and associated methods? Merging the summed 'Value' per group with a separate 'SampleMeta' DataFrame works but there must be a more elegant solution.  </p>