apply_multi_component_map()
Apply a single MultiComponentMap with regex support, preserving rule order.
Usage
apply_multi_component_map(
df,
multi_component_map,
verbose=False,
)Rules are applied in the order they appear in the MultiRepresentationMap. The first matching rule wins. Patterns prefixed with "regex:" are matched using re.fullmatch.
Only the first target column is used; multi-target MultiComponentMaps are not supported.
Parameters
df: pd.DataFrame-
Source data.
multi_component_map: px.model.map.MultiComponentMap-
MultiComponentMap with source columns, target column, and values.
verbose: bool = False- If True, print progress.
Returns
pd.DataFrame- DataFrame with the target column added or overwritten.