gather_and_replace

gather_and_replace#

powerplantmatching.cleaning.gather_and_replace(df, mapping)#

Search for patterns in multiple columns and return a series of represantativ keys.

The function will return a series of unique identifiers given by the keys of the mapping dictionary. The order in the mapping dictionary determines which represantativ keys are calculated first. Note that these may be overwritten by the following mappings.

Parameters:
  • df (pandas.DataFrame) – DataFrame with columns that should be parsed.

  • mapping (dict) – Dictionary mapping the represantativ keys to the regex patterns.