Filter & Label Utils
Filter ibis table rows by arbitrary boolean conditions and tag the matches.
filter_and_label_by_condition(table, conditions, label_col='label')
Filter rows matching any condition and tag each kept row with its matching label.
A row is kept if it matches at least one condition; the label is the first matching
key in the dict order of conditions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
table
|
Table
|
The ibis table to filter. |
required |
conditions
|
dict[str, BooleanColumn]
|
Labels mapped to boolean row conditions. |
required |
label_col
|
str
|
Name of the label column to add. Defaults to |
'label'
|
Returns:
| Type | Description |
|---|---|
Table
|
ibis.Table: Filtered table with the label column added. |