Label Utils
Label ibis groups by whether items meet a condition (binary or extended strategies).
label_by_condition(table, condition, label_col=None, return_col='label_name', labeling_strategy='binary', contains_label='contains', not_contains_label='not_contains', mixed_label='mixed')
Label groups in a table based on whether their items meet a condition.
binary: a group is labeled contains if ANY item meets the condition, else
not_contains. extended: contains (all items meet it), mixed (some do),
not_contains (none do).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
table
|
Table
|
The ibis table to label. |
required |
condition
|
BooleanColumn
|
Boolean expression evaluated per row. |
required |
label_col
|
str | None
|
Column to group by. If None, uses the |
None
|
return_col
|
str
|
Name of the added label column. |
'label_name'
|
labeling_strategy
|
Literal['binary', 'extended']
|
Labeling strategy. |
'binary'
|
contains_label
|
str | Value
|
Label for contains. |
'contains'
|
not_contains_label
|
str | Value
|
Label for not_contains. |
'not_contains'
|
mixed_label
|
str | Value
|
Label for mixed (extended strategy only). |
'mixed'
|
Returns:
| Type | Description |
|---|---|
Table
|
ibis.Table: One row per group, with only the |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |