title: Sorting Values by Second Column Used in Groupby Pandas
body: <p>I have the following dataframe:</p>
  
  <pre><code>data = {
      'CH': [0,1,0,1,0,0,0,0,1,0,0,0,1,1,1,0,0,0,1],
      'Z': [10, 11, 10, 12, 13, 10, 11, 12, 13, 14, 11, 13, 10, 11, 12, 13, 14, 14, 14],
      'Res': [23, 43, 21, 23, 43, 9, 21, 13, 23, 43, 31, 27, 31, 33, 54, 17, 19, 23, 33]
      }
  
  df = pd.DataFrame(data)
  </code></pre>
  
  <p>If I do <code>df.groupby(['CH', 'Z']).mean()</code>, I get the following:</p>
  
  <p><a href="https://i.stack.imgur.com/71e4v.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/71e4v.png" alt="Pandas groupby"></a></p>
  
  <p>I would like to be able to sort the values by the <code>Z</code> column in descending order.  </p>
  
  <p>I'd also like to sort values by the values in the <code>Res</code> column too, but the first is most important.</p>
  
  <p>Thank you.</p>