I have the following Multi-Index table:
| A | B | C | D | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| t_1 | t_2 | t_1 | t_2 | t_1 | t_2 | t_1 | t_2 | ||||||||
| x | y | x | y | x | y | x | y | x | y | x | y | x | y | x | y |
| 2.2 | 5.1 | 3.4 | 1.8 | 1.5 | 6.7 | 8.1 | 7.5 | 6.1 | 2.1 | 9.3 | 7.1 | 8.2 | 1.1 | 1.4 | 2.5 |
| 7.9 | 3.2 | 1.1 | 5.3 | 9.3 | 3.1 | 0.9 | 3.2 | 4.1 | 5.1 | 7.7 | 4.3 | 8.1 | 0.4 | 2.4 | 4.1 |
Data Points (x, y) have been randomly assigned to columns A - D. I want to re-order them by the x-value at t_1 - shown in italics. The other values don't matter for re-ordering, but are carried along to their new column by the x-value at t_1. This means each row will be re-ordered differently.
I want some code which processes the above table to produce:
| A | B | C | D | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| t_1 | t_2 | t_1 | t_2 | t_1 | t_2 | t_1 | t_2 | ||||||||
| x | y | x | y | x | y | x | y | x | y | x | y | x | y | x | y |
| 1.5 | 6.7 | 8.1 | 7.5 | 2.2 | 5.1 | 3.4 | 1.8 | 6.1 | 2.1 | 9.3 | 7.1 | 8.2 | 1.1 | 1.4 | 2.5 |
| 4.1 | 5.1 | 7.7 | 4.3 | 7.9 | 3.2 | 1.1 | 5.3 | 8.1 | 0.4 | 2.4 | 4.1 | 9.3 | 3.1 | 0.9 | 3.2 |

