title: Creating mean and sum dataframe using groupby
body: <p>I have this dataframe whereby I wish to calculate the <strong>mean and sum</strong> from the column 'Score'. I do not want to use the .groupby().agg() method.</p>
  
  <pre><code>df = pd.DataFrame({
  'Country': ['Germany', 'Germany', 'Canada', 'Canada'], 
  'Score': [8, 4, 35, 50], 
   'Continent': ['Europe', 'Europe', 'North America', 'North America']},
  columns=['Country','Score','Continent'])
  print (df)
  </code></pre>
  
  <p>Dataframe becomes:</p>
  
  <pre><code>   Country          Score      Continent
  0  Germany              8         Europe
  1  Germany              4         Europe
  2   Canada             35  North America
  3   Canada             50  North America
  </code></pre>
  
  <p>The easiest method I have found is:</p>
  
  <pre><code>new_df = df.groupby('Continent')['Score'].agg({'sum': np.sum, 'avg': np.average})
  
  Continent               
  Europe          12   6.0
  North America   85  42.5
  </code></pre>
  
  <p>I now have 2 series average and total. How do I make that into a new dataframe using the index from .groupby('Continent')?</p>
  
  <p>I'm trying to use the <strong>group, frame method</strong> here:</p>
  
  <pre><code>for group, frame in df.groupby('Continent'):
          avg = np.average(frame['Score'])
          total = np.sum(frame['Score']) 
          df['avg'] = avg
          df['sum'] = total
  </code></pre>