daft.functions.list_filter#
list_filter #
list_filter(list_expr: Expression, predicate: Expression) -> Expression
Filters elements in a list using a boolean predicate expression.
Elements where the predicate evaluates to False or null are removed. Null list rows remain null. Empty list rows remain empty.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
list_expr | List Expression | expression to filter. | required |
predicate | Expression | Boolean expression to evaluate on each element. Use | required |
Returns:
| Name | Type | Description |
|---|---|---|
Expression | List Expression | an expression representing the filtered list. |
Examples:
1 2 3 4 | |
╭──────────────┬──────────────╮
│ letters ┆ no_b │
│ --- ┆ --- │
│ List[String] ┆ List[String] │
╞══════════════╪══════════════╡
│ [a, b, a] ┆ [a, a] │
├╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
│ [b, c, b, c] ┆ [c, c] │
╰──────────────┴──────────────╯
(Showing first 2 of 2 rows) Source code in daft/functions/list.py
349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 | |