tabsdata.tableframe.functions.lit.lit#

lit(value: Any, dtype: td_typing.TdDataType | None = None, *, allow_object: bool = False) td_expr.Expr[source]#

Expression for the given literal value.

Parameters:
  • value – The literal value.

  • dtype – The data type of the literal value.

  • allow_object – Whether to allow object data type.

Example:

>>> import tabsdata as td
>>>
>>> tf: td.TableFrame ...
>>>
>>> tf.select(td.lit("Hi").alias("lit"), td.col("age").alias("Age"))
>>>
┌──────┬──────┐
│ lit  ┆ Age  │
│ ---  ┆ ---  │
│ str  ┆ i64  │
╞══════╪══════╡
│ Hi   ┆ 1    │
│ Hi   ┆ 15   │
│ Hi   ┆ 18   │
│ Hi   ┆ null │
└──────┴──────┘