Skip to content

featurebyte.Target.str.replace

replace(
pat: str,
repl: str
) -> Target

Description

Replaces the substring within each string element.

Parameters

  • pat: str
    Substring to match.

  • repl: str
    Replacement string.

Returns

  • Target
    A new Target object.

Examples

Replace "Windows" with "Win" in the ProductGroupLookup target:

>>> target = catalog.get_target("ProductGroupLookup")
>>> target["ProductGroupNew"] = target.str.replace("Windows", "Win")