title: Pandas re-ordering values in Multi-Index columns on a row-by-row basis
body: <p>I have the following Multi-Index table:</p>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th>A</th>
  <th></th>
  <th></th>
  <th></th>
  <th>B</th>
  <th></th>
  <th></th>
  <th></th>
  <th>C</th>
  <th></th>
  <th></th>
  <th></th>
  <th>D</th>
  <th></th>
  <th></th>
  <th></th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td><strong>t_1</strong></td>
  <td></td>
  <td><strong>t_2</strong></td>
  <td></td>
  <td><strong>t_1</strong></td>
  <td></td>
  <td><strong>t_2</strong></td>
  <td></td>
  <td><strong>t_1</strong></td>
  <td></td>
  <td><strong>t_2</strong></td>
  <td></td>
  <td><strong>t_1</strong></td>
  <td></td>
  <td><strong>t_2</strong></td>
  <td></td>
  </tr>
  <tr>
  <td><strong>x</strong></td>
  <td><strong>y</strong></td>
  <td><strong>x</strong></td>
  <td><strong>y</strong></td>
  <td><strong>x</strong></td>
  <td><strong>y</strong></td>
  <td><strong>x</strong></td>
  <td><strong>y</strong></td>
  <td><strong>x</strong></td>
  <td><strong>y</strong></td>
  <td><strong>x</strong></td>
  <td><strong>y</strong></td>
  <td><strong>x</strong></td>
  <td><strong>y</strong></td>
  <td><strong>x</strong></td>
  <td><strong>y</strong></td>
  </tr>
  <tr>
  <td><em>2.2</em></td>
  <td>5.1</td>
  <td>3.4</td>
  <td>1.8</td>
  <td><em>1.5</em></td>
  <td>6.7</td>
  <td>8.1</td>
  <td>7.5</td>
  <td><em>6.1</em></td>
  <td>2.1</td>
  <td>9.3</td>
  <td>7.1</td>
  <td><em>8.2</em></td>
  <td>1.1</td>
  <td>1.4</td>
  <td>2.5</td>
  </tr>
  <tr>
  <td><em>7.9</em></td>
  <td>3.2</td>
  <td>1.1</td>
  <td>5.3</td>
  <td><em>9.3</em></td>
  <td>3.1</td>
  <td>0.9</td>
  <td>3.2</td>
  <td><em>4.1</em></td>
  <td>5.1</td>
  <td>7.7</td>
  <td>4.3</td>
  <td><em>8.1</em></td>
  <td>0.4</td>
  <td>2.4</td>
  <td>4.1</td>
  </tr>
  </tbody>
  </table>
  </div>
  <p>Data Points <code>(x, y)</code> have been randomly assigned to columns A - D. I want to re-order them by the <code>x</code>-value at <code>t_1</code> - shown in <em>italics</em>. The other values don't matter for re-ordering, but are carried along to their new column by the <code>x</code>-value at <code>t_1</code>. This means <em><strong>each row will be re-ordered differently</strong></em>.</p>
  <p>I want some code which processes the above table to produce:</p>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th>A</th>
  <th></th>
  <th></th>
  <th></th>
  <th>B</th>
  <th></th>
  <th></th>
  <th></th>
  <th>C</th>
  <th></th>
  <th></th>
  <th></th>
  <th>D</th>
  <th></th>
  <th></th>
  <th></th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td><strong>t_1</strong></td>
  <td></td>
  <td><strong>t_2</strong></td>
  <td></td>
  <td><strong>t_1</strong></td>
  <td></td>
  <td><strong>t_2</strong></td>
  <td></td>
  <td><strong>t_1</strong></td>
  <td></td>
  <td><strong>t_2</strong></td>
  <td></td>
  <td><strong>t_1</strong></td>
  <td></td>
  <td><strong>t_2</strong></td>
  <td></td>
  </tr>
  <tr>
  <td><strong>x</strong></td>
  <td><strong>y</strong></td>
  <td><strong>x</strong></td>
  <td><strong>y</strong></td>
  <td><strong>x</strong></td>
  <td><strong>y</strong></td>
  <td><strong>x</strong></td>
  <td><strong>y</strong></td>
  <td><strong>x</strong></td>
  <td><strong>y</strong></td>
  <td><strong>x</strong></td>
  <td><strong>y</strong></td>
  <td><strong>x</strong></td>
  <td><strong>y</strong></td>
  <td><strong>x</strong></td>
  <td><strong>y</strong></td>
  </tr>
  <tr>
  <td><em>1.5</em></td>
  <td>6.7</td>
  <td>8.1</td>
  <td>7.5</td>
  <td><em>2.2</em></td>
  <td>5.1</td>
  <td>3.4</td>
  <td>1.8</td>
  <td><em>6.1</em></td>
  <td>2.1</td>
  <td>9.3</td>
  <td>7.1</td>
  <td><em>8.2</em></td>
  <td>1.1</td>
  <td>1.4</td>
  <td>2.5</td>
  </tr>
  <tr>
  <td><em>4.1</em></td>
  <td>5.1</td>
  <td>7.7</td>
  <td>4.3</td>
  <td><em>7.9</em></td>
  <td>3.2</td>
  <td>1.1</td>
  <td>5.3</td>
  <td><em>8.1</em></td>
  <td>0.4</td>
  <td>2.4</td>
  <td>4.1</td>
  <td><em>9.3</em></td>
  <td>3.1</td>
  <td>0.9</td>
  <td>3.2</td>
  </tr>
  </tbody>
  </table>
  </div>