title: Looking for a way to produce a table of statistics from columns in a data frame
body: <p>I have a data set with categories/codes e.g. male/female, state of service, code of service and I have a column of paid claims.</p>
  
  <p>I am looking for a way to create a table/pivot using Python to generate outputs where I only have the top 10 highest column of average paid claims by code of service (i.e. what are the top 10 codes with highest average paid claims). I also wanted to append with median, stdev, counts so the output looks something like</p>
  
  <p>Table:</p>
  
  <pre><code>gender, code, state, paid claim
  F, 1234, TX, $300
  F, 2345, NJ, $120
  F, 3456, NJ, $30
  M, 1234, MN, $250
  M, 4567, CA, $50
  F, 1234, MA, $70
  F, 8901, CA, $150
  F, 23457, NY, $160
  F, 4567, SD, $125
  </code></pre>
  
  <p>Output I am trying to generate (top 10 ave paid claim by code):</p>
  
  <pre><code>code, average claim, median claim, count claim
  1234,  206, xxx, 3
  </code></pre>
  
  <p>So, I did something like:</p>
  
  <pre><code>service_code_average=df.groupby('service_code', as_index=False)['paid claim'].mean().sort_values(by='paid claim')
  </code></pre>
  
  <p>I was not able to limit to top 10 and I was struggling to append the media and count.</p>