Skip to content

featurebyte.Feature.str.replace

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

Description

Replaces the substring within each string element.

Parameters

  • pat: str
    Substring to match.

  • repl: str
    Replacement string.

Returns

  • Feature
    A new Feature object.

Examples

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

>>> feature = catalog.get_feature("ProductGroupLookup")
>>> feature_group = fb.FeatureGroup([feature])
>>> feature_group["ProductGroupNew"] = feature.str.replace("Windows", "Win")