title: How can I sort within partitions defined by one column but leave the partitions where they are?
body: <p>Consider the dataframe <code>df</code></p>
  
  <pre><code>df = pd.DataFrame(dict(
          A=list('XXYYXXYY'),
          B=range(8, 0, -1)
      ))
  
  print(df)
  
     A  B
  0  X  8
  1  X  7
  2  Y  6
  3  Y  5
  4  X  4
  5  X  3
  6  Y  2
  7  Y  1
  </code></pre>
  
  <p>With the <code>'X'</code> group defined by column <code>'A'</code>, I want to sort <code>[8, 7, 4, 3]</code> to the expected <code>[3, 4, 7, 8]</code>.  However, I want to leave those rows where they are.</p>
  
  <pre><code>   A  B
  5  X  3  &lt;-- Notice all X are in same positions
  4  X  4  &lt;-- However, `[3, 4, 7, 8]` have shifted
  7  Y  1
  6  Y  2
  1  X  7  &lt;-- 
  0  X  8  &lt;-- 
  3  Y  5
  2  Y  6
  </code></pre>