title: using built-in pandas groupby metrics drawn from a list of said metrics
body: <p>I have a dataframe for which I have to calculate a series of metrics grouped by certain columns in the dataframe. I'd like to do this using a loop, but I cannot seem to figure out how (if there is a correct way). </p>
  
  <p>So, what I'm trying to do is basically (semi-pseudo code, this does not run for obvious reasons): </p>
  
  <pre><code>df = pd.DataFrame({'ID': ['A', 'B', 'A', 'C', 'B', 'C', 'A'],
                     'Score': range(7)})
  
  group = df.groupby('ID')
  for stat in ['mean', 'min', 'max']:
      group.stat()
  </code></pre>
  
  <p>I can get this to work if I use <code>numpy</code> and <code>getattr</code>. I.E.:</p>
  
  <pre><code>for stat in ['mean', 'min', 'max']:
      df.groupby('ID').apply(getattr(np, stat))
  </code></pre>
  
  <p>The problem with this is that it is significantly slower than using the built-in <code>.mean()</code>, etc. pandas provides (at least for the size dataframe that I'm working with). </p>
  
  <p>Is there a more appropriate way to accomplish this? </p>