Expr.str.replace_many
methodView source ↗
def replace_many(
patterns: td_IntoExpr | Mapping[str, str],
replace_with: td_IntoExpr | NoDefault = <no_default>,
ascii_case_insensitive: bool = False,
) -> Expr
Categories: string
Replace the all occurences of any the given patterns with the given string.
Parameters
parameter
patternsThe patterns to replace.
parameter
replace_withThe value to replace the pattern with.
parameter
ascii_case_insensitiveIf true, the search is case-insensitive.
Examples
>>> import tabsdata as td
>>>
>>> tf: td.TableFrame ...
>>>
>>> tf.select(td.col("a"), td.col("a")
.str.replace_many(["a", "b"], "X").alias("replace_many"))
>>>
┌──────┬──────────────┐
│ a ┆ replace_many │
│ --- ┆ --- │
│ str ┆ str │
╞══════╪══════════════╡
│ abc ┆ XXc │
│ axy ┆ Xxy │
│ xyb ┆ xyX │
│ xyz ┆ xyz │
│ null ┆ null │
└──────┴──────────────┘