(
table: pw.Table, *on: pw.ColumnReference, what: pw.ColumnReference
)
| 18 | |
| 19 | |
| 20 | def argmin_rows( |
| 21 | table: pw.Table, *on: pw.ColumnReference, what: pw.ColumnReference |
| 22 | ) -> pw.Table: |
| 23 | filter = ( |
| 24 | table.groupby(*on) |
| 25 | .reduce(argmin_id=pw.reducers.argmin(what)) |
| 26 | .with_id(pw.this.argmin_id) |
| 27 | .promise_universe_is_subset_of(table) |
| 28 | ) |
| 29 | return table.restrict(filter) |