tabsdata.tableframe.expr.string.ExprStringNameSpace.find#

ExprStringNameSpace.find(pattern: str | Expr, *, literal: bool = False, strict: bool = True) Expr[source]#

Find the position of the first occurrence of the given pattern.

Parameters:
  • pattern – The pattern to search for.

  • literal – Take the pattern as a literal string (not a regex).

  • strict – if the given pattern is not valid regex, raise an error.

Example:

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