tabsdata.tableframe.expr.string.ExprStringNameSpace.head#

ExprStringNameSpace.head(n: int | Expr | Series | str) Expr[source]#

Extract the start of the string up to the given length.

Parameters:

n – The length of the head.

Example:

>>> import tabsdata as td
>>>
>>> tf: td.TableFrame ...
>>>
>>> tf.select(td.col("a"), td.col("a").str.head(2).alias("head"))
>>>
┌──────┬──────┐
│ a    ┆ head │
│ ---  ┆ ---  │
│ str  ┆ str  │
╞══════╪══════╡
│ abc  ┆ ab   │
│ a    ┆ a    │
│ null ┆ null │
└──────┴──────┘