daft.lit

Contents

daft.lit#

lit(value: object) Expression[source]#

Creates an Expression representing a column with every value set to the provided value

Example

>>> import daft
>>> df = daft.from_pydict({"x": [1, 2, 3]})
>>> df = df.with_column("y", daft.lit(1))
>>> df.show()
╭───────┬───────╮
│ x     ┆ y     │
│ ---   ┆ ---   │
│ Int64 ┆ Int32 │
╞═══════╪═══════╡
│ 1     ┆ 1     │
├╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌┤
│ 2     ┆ 1     │
├╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌┤
│ 3     ┆ 1     │
╰───────┴───────╯

(Showing first 3 of 3 rows)
Parameters:

val – value of column

Returns:

Expression representing the value provided

Return type:

Expression