title: "ValueError: Length of values does not match length of index" when trying to modify column values a pandas groupby
body: <p>I have a dataframe:</p>
  
  <pre><code>       A         C         D
  0    one  0.410599 -0.205158
  1    one  0.144044  0.313068
  2    one  0.333674 -0.742165
  3  three  0.761038 -2.552990
  4  three  1.494079  2.269755
  5    two  1.454274 -0.854096
  6    two  0.121675  0.653619
  7    two  0.443863  0.864436
  </code></pre>
  
  <p>Let's assume that <code>A</code> is the anchor column. I now want to display each group value <em>only once</em>, at the top:</p>
  
  <pre><code>        A         C         D
  0    one  0.410599 -0.205158
  1         0.144044  0.313068
  2         0.333674 -0.742165
  3  three  0.761038 -2.552990
  4         1.494079  2.269755
  5    two  1.454274 -0.854096
  6         0.121675  0.653619
  7         0.443863  0.864436
  </code></pre>
  
  <p>This is what I've come up with:</p>
  
  <pre><code>df['A'] = df.groupby('A', as_index=False)['A']\
          .apply(lambda x: x.str.replace('.*', '').set_value(0, x.values[0])).values
  </code></pre>
  
  <p>My strategy was to do a groupby and then set all values to an empty string other than the first. This doesn't seem to work, because I get:</p>
  
  <pre><code>ValueError: Length of values does not match length of index
  </code></pre>
  
  <p>Which means that the output I get is incorrect. Any ideas/suggestions/improvements welcome. </p>
  
  <p>I should add that I am trying to generalise a solution that can single out values at the top OR bottom OR middle of each group, so I'd give more preference to a solution that helps me do that (to understand, the example above shows how to single out values <em>only at the top of each group</em>, however, I want to generalise a solution that allows me to single them out at the bottom or in the middle).</p>