daft.functions.list_sort#
list_sort #
list_sort(list_expr: Expression, desc: bool | Expression | None = None, nulls_first: bool | Expression | None = None) -> Expression
Sorts the inner lists of a list column.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
list_expr | List Expression | expression to sort | required |
desc | bool | Expression | None | (bool | Boolean Expression) Whether to sort in descending order. Defaults to false. Pass in a boolean column to control for each row. | None |
nulls_first | bool | Expression | None | (bool | Boolean Expression) Whether to put nulls first. Defaults to false (nulls last). Pass in a boolean column to control for each row. | None |
Returns:
| Name | Type | Description |
|---|---|---|
Expression | List Expression | an expression with the sorted lists |
Examples:
1 2 3 4 | |
╭─────────────╮
│ a │
│ --- │
│ List[Int64] │
╞═════════════╡
│ [1, 3] │
├╌╌╌╌╌╌╌╌╌╌╌╌╌┤
│ [2, 4] │
├╌╌╌╌╌╌╌╌╌╌╌╌╌┤
│ [1, 6, 7] │
╰─────────────╯
(Showing first 3 of 3 rows) Source code in daft/functions/list.py
231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 | |