Expr.str.find
methodView source ↗
def find(pattern: str | Expr, literal: bool = False, strict: bool = True) -> Expr
Categories: string
Find the position of the first occurrence of the given pattern.
Parameters
parameter
patternThe pattern to search for.
parameter
literalTake the pattern as a literal string (not a regex).
parameter
strictif the given pattern is not valid regex, raise an error.
Examples
>>> 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 │
└──────┴──────┘