daft.list_#
- list_(*items: daft.expressions.expressions.Expression | str)[source]#
Constructs a list from the item expressions.
Example
>>> import daft >>> df = daft.from_pydict({"x": [1, 2, 3], "y": [4, 5, 6]}) >>> df = df.select(daft.list_("x", "y").alias("fwd"), daft.list_("y", "x").alias("rev")) >>> df.show() ╭─────────────┬─────────────╮ │ fwd ┆ rev │ │ --- ┆ --- │ │ List[Int64] ┆ List[Int64] │ ╞═════════════╪═════════════╡ │ [1, 4] ┆ [4, 1] │ ├╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌┤ │ [2, 5] ┆ [5, 2] │ ├╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌┤ │ [3, 6] ┆ [6, 3] │ ╰─────────────┴─────────────╯ (Showing first 3 of 3 rows)
- Parameters:
*items (Union[Expression, str]) – item expressions to construct the list
- Returns:
Expression representing the constructed list
- Return type:
Expression