INNER CODE UNIT · Python
_replace_values
aeturrell/skimpy · src/skimpy/__init__.py:1024
def _replace_values(name: Any, mapping: dict[str, str]) -> Any:
"""_summary_
Args:
name (Any): Column name.
mapping (dict[str, str]): Maps old values in the column name to the new values.
Returns:
Any: Re-mapped column name.
"""
if name in NULL_VALUES:
return name
name = str(name)
for old_value, new_value in mapping.items():
# If the old value or the new value is not alphanumeric, add underscores to the
# beginning and end so the new value will be parsed correctly for _convert_case()
new_val = (