title: When does df.groupby(...).agg(myagg) pass a Series to myagg?
body: <p>Consider the DataFrame:</p>
  
  <pre><code>import pandas as pd
  df = pd.DataFrame({'A':[1,2,1,2],
                     'B':[1,2,1,2],
                     'C':list('WXYZ'),
                     'D':list('abcd')})
  df.set_index('A', inplace=True)
  print(df)
  #    B  C  D
  # A         
  # 1  1  W  a
  # 2  2  X  b
  # 1  1  Y  c
  # 2  2  Z  d
  
  def myagg(x):
      print(type(x).__name__)
      print(x)
  </code></pre>
  
  <p>Usually, <code>df.groupby(...).agg(myagg)</code> will pass (sub)DataFrames to
  <code>myagg</code>. For example,</p>
  
  <pre><code>df.groupby(level=0).agg(myagg)
  # DataFrame
  #    B  C  D
  # A         
  # 1  1  W  a
  # 1  1  Y  c
  # DataFrame
  #    B  C  D
  # A         
  # 2  2  X  b
  # 2  2  Z  d
  </code></pre>
  
  <p>However, if you use a multilevel index, then myagg is passed a Series:</p>
  
  <pre><code>df2 = df.set_index(['B'], append=True)
  df2.groupby(level=['A','B']).agg(myagg)
  # Series
  # A  B
  # 1  1    W
  #    1    Y
  # Name: C
  # Series
  # A  B
  # 2  2    X
  #    2    Z
  # Name: C
  # Series
  # A  B
  # 1  1    a
  #    1    c
  # Name: D
  # Series
  # A  B
  # 2  2    b
  #    2    d
  # Name: D
  </code></pre>
  
  <p>Sometimes this can be quite useful, but I would like to understand better 
  when does <code>agg</code> pass single columns (Series) to <code>myagg</code>, and when does it pass
  whole DataFrames?</p>