title: pandas sort values of one column by the average of the other column
body: <p>assuming I have the following dataframe:</p>
  
  <pre><code>    A    B
  1  cat   3
  2  cat   7
  3  dog   5
  4  dog   8
  5  dog   11 
  6  bird  3
  7  bird  5
  </code></pre>
  
  <p>The average of 'cat' is 5, the average of 'dog' is 8 and the average of 'bird' is 4, thus I want to sort the dataframe so that dog will be first, than cat and than bird, like the following:</p>
  
  <pre><code>    A    B
  1  dog   5
  2  dog   8
  3  dog   11
  4  cat   3
  5  cat   7
  6  bird  3
  7  bird  5
  </code></pre>
  
  <p>what is the best way of doing this? 
  I tried to set the 'A' column to index and than play with sorting it but I couldn't figure it out. 
  Any help will be appreciated!</p>