| 6709 | |
| 6710 | |
| 6711 | def test_python_tuple_sorting(): |
| 6712 | t = T( |
| 6713 | """ |
| 6714 | a | b | c |
| 6715 | 1 | 3 | 2 |
| 6716 | 2 | 4 | 1 |
| 6717 | 3 | 3 | 6 |
| 6718 | 4 | 2 | 8 |
| 6719 | 5 | 5 | 6 |
| 6720 | 6 | 1 | 4 |
| 6721 | 7 | 2 | 2 |
| 6722 | 8 | 3 | 3 |
| 6723 | """ |
| 6724 | ) |
| 6725 | sorted = t.sort(key=(pw.this.b, pw.this.c)) |
| 6726 | result = t.select(pw.this.a, prev_a=t.ix(sorted.prev, optional=True).a) |
| 6727 | expected = T( |
| 6728 | """ |
| 6729 | a | prev_a |
| 6730 | 1 | 4 |
| 6731 | 2 | 3 |
| 6732 | 3 | 8 |
| 6733 | 4 | 7 |
| 6734 | 5 | 2 |
| 6735 | 6 | |
| 6736 | 7 | 6 |
| 6737 | 8 | 1 |
| 6738 | """ |
| 6739 | ) |
| 6740 | assert_table_equality(result, expected) |
| 6741 | |
| 6742 | |
| 6743 | def test_table_to_pandas_with_id(): |