title: New Pandas Groupby API Changes
body: <p>I have a dataframe, where rows have a Name, a Type, and an SLA column.  The SLA column is a numerical value: 1, 2 or 3.  The SLA column is specific to type, not name.</p>
  
  <p>I have code that creates a new column, which groups by the name values, and enforces the same numerical value for all rows with the same name.  I.e. if all the SLA values for a given name are 2, then they all get 2.  If they are all 3, then they get 3.  Otherwise (if all values are 2 or more likely if there's a mix of values), they all get 2.</p>
  
  <pre><code>df['SLA_Norm'] = df.groupby('Name').apply(assignSLA)
  </code></pre>
  
  <p>With the function:</p>
  
  <pre><code>def assignSLA(df):
      a = pd.Series(df['SLA'], df.index)
      m = a.mean()
      if m == 1.0:
          n = [1]
          n = n*len(a)
          return pd.Series(n, df.index)
      elif m == 3.0:
          n = [3]
          n = n*len(a)
          return pd.Series(n, df.index)
      else:
          n = [2]
          n = n*len(a)
          return pd.Series(n, df.index)
  </code></pre>
  
  <p>After updating the pandas library, which recently updated the groupby api, this function breaks.  However, I can't figure out why.  Does anyone know why the new groupby functionality in pandas would break this function?</p>
  
  <p>Thanks kindly.</p>
  
  <p>EDIT:</p>
  
  <p>So starting with df:</p>
  
  <pre><code>Name    Type    SLA
  Foo     A       1       
  Foo     B       2       
  Foo     C       3       
  Buzz    A       1       
  Buzz    A       1       
  Buzz    A       1       
  Buzz    A       1       
  Buzz    A       1       
  Bar     C       3       
  Bar     C       3       
  Bar     C       3   
  </code></pre>
  
  <p>I used to get, with pandas 13.0:</p>
  
  <pre><code>Name    Type    SLA     SLA_Norm
  Foo     A       1       2
  Foo     B       2       2
  Foo     C       3       2
  Buzz    A       1       1
  Buzz    A       1       1
  Buzz    A       1       1
  Buzz    A       1       1
  Buzz    A       1       1
  Bar     C       3       3
  Bar     C       3       3
  Bar     C       3       3  
  </code></pre>
  
  <p>Now I get, with pandas 14.0:</p>
  
  <pre><code>Name    Type    SLA     SLA_Norm
  Foo     A       1       NaN
  Foo     B       2       NaN
  Foo     C       3       NaN
  Buzz    A       1       NaN
  Buzz    A       1       NaN
  Buzz    A       1       NaN
  Buzz    A       1       NaN
  Buzz    A       1       NaN
  Bar     C       3       NaN
  Bar     C       3       NaN
  Bar     C       3       NaN
  </code></pre>