Return a tuple containing all the aggregated values. Order of values inside a tuple is consistent across application to many columns. If optional argument skip_nones is set to True, any Nones in aggregated values are omitted from the result. Example: >>> import pathway as pw
(arg: expr.ColumnExpression, *, skip_nones: bool = False)
| 608 | |
| 609 | |
| 610 | def tuple(arg: expr.ColumnExpression, *, skip_nones: bool = False): |
| 611 | """ |
| 612 | Return a tuple containing all the aggregated values. Order of values inside a tuple |
| 613 | is consistent across application to many columns. If optional argument skip_nones is |
| 614 | set to True, any Nones in aggregated values are omitted from the result. |
| 615 | |
| 616 | Example: |
| 617 | |
| 618 | >>> import pathway as pw |
| 619 | >>> t = pw.debug.table_from_markdown(''' |
| 620 | ... | colA | colB | colC | colD |
| 621 | ... 1 | valA | -1 | 5 | 4 |
| 622 | ... 2 | valA | 1 | 5 | 7 |
| 623 | ... 3 | valA | 2 | 5 | -3 |
| 624 | ... 4 | valB | 4 | 10 | 2 |
| 625 | ... 5 | valB | 4 | 10 | 6 |
| 626 | ... 6 | valB | 7 | 10 | 1 |
| 627 | ... ''') |
| 628 | >>> result = t.groupby(t.colA).reduce( |
| 629 | ... tuple_B=pw.reducers.tuple(t.colB), |
| 630 | ... tuple_C=pw.reducers.tuple(t.colC), |
| 631 | ... tuple_D=pw.reducers.tuple(t.colD), |
| 632 | ... ) |
| 633 | >>> pw.debug.compute_and_print(result, include_id=False) |
| 634 | tuple_B | tuple_C | tuple_D |
| 635 | (-1, 1, 2) | (5, 5, 5) | (4, 7, -3) |
| 636 | (4, 4, 7) | (10, 10, 10) | (2, 6, 1) |
| 637 | """ |
| 638 | return _apply_unary_reducer(_tuple(skip_nones), arg, skip_nones=skip_nones) |
| 639 | |
| 640 | |
| 641 | def count(*args): |