mapping module¶
Mapping utilities.
apply_mapping function¶
apply_mapping(
obj,
mapping_like=None,
enum_unkval=-1,
reverse=False,
ignore_case=True,
ignore_underscores=True,
ignore_invalid=True,
ignore_type=None,
ignore_missing=False,
na_sentinel=None
)
Apply mapping on object using a mapping-like object.
Args
obj:any-
Any object.
Can take a scalar, tuple, list, set, frozenset, NumPy array, Index, Series, and DataFrame.
mapping_like:mapping_like-
Any mapping-like object.
See to_value_mapping().
enum_unkval:any- Missing value for enumerated types.
reverse:bool- See
reversein to_value_mapping(). ignore_case:bool- Whether to ignore the case if the key is a string.
ignore_underscores:bool- Whether to ignore underscores if the key is a string.
ignore_invalid:bool- Whether to remove any character that is not allowed in a Python variable.
ignore_type:dtype_likeortuple- One or multiple types or data types to ignore.
ignore_missing:bool- Whether to ignore missing values.
na_sentinel:any- Value to mark “not found”.
reverse_mapping function¶
Reverse a mapping.
Returns a dict.
to_field_mapping function¶
Convert mapping-like object to a field mapping.
to_value_mapping function¶
Convert mapping-like object to a value mapping.
Enable reverse to apply reverse_mapping() on the result dict.