Expr.str.extract
methodView source ↗
def extract(pattern: td_IntoExprColumn, group_index: int = 1) -> Expr
Categories: string
Extract a pattern from the string.
Parameters
parameter
patternThe pattern to extract.
parameter
group_indexThe group index to extract.
Examples
>>> import tabsdata as td
>>>
>>> tf: td.TableFrame ...
>>>
>>> tf.select(td.col("a"), td.col("a").str.extract("(b.b)", 1).alias("extract"))
>>>
┌───────────┬─────────┐
│ a ┆ extract │
│ --- ┆ --- │
│ str ┆ str │
╞═══════════╪═════════╡
│ a bAb c d ┆ bAb │
│ bCbb c d ┆ bCb │
│ bb ┆ null │
│ null ┆ null │
└───────────┴─────────┘