title: user-defined function for pandas groupby
body: <pre><code>def integration(*arg):
      try:
          return np.sum(arg)
      except:
          name = arg
          return name
  </code></pre>
  <p>Hi~ This is my function and I want to apply this function to DataFrame like this</p>
  <pre><code>   k  g  r
  0  dd cc hh
  1  bb  1  9
  2  dd aa ll
  3  bb  4  6
  </code></pre>
  <p>and a result I got is</p>
  <pre><code>     g    r
  k  
  bb   5    15
  dd  ccaa  hhll
  </code></pre>
  <p>I want 'cc' instead of 'ccaa' and 'hh' instead of 'hhll'. I want to reflect only upper one when length of the input of user-defined funtion exceeds 2 or more.</p>