dataeval.utils.flatten¶
-
dataeval.utils.flatten(d: collections.abc.Mapping[str, Any], return_dropped: True, sep: str =
'_', ignore_lists: bool =False, fully_qualified: bool =False) tuple[dict[str, Any], int, dict[str, list[str]]]¶ -
dataeval.utils.flatten(d: collections.abc.Mapping[str, Any], return_dropped: False =
False, sep: str ='_', ignore_lists: bool =False, fully_qualified: bool =False) tuple[dict[str, Any], int] Flattens a dictionary and converts values to numeric values when possible.
- Parameters:¶
- d : dict[str, Any]¶
Dictionary to flatten
- return_dropped : bool, default False¶
Option to return a dictionary of dropped keys and the reason(s) for dropping
- sep : str, default "_"¶
String separator to use when concatenating key names
- ignore_lists : bool, default False¶
Option to skip expanding lists within metadata
- fully_qualified : bool, default False¶
Option to return dictionary keys fully qualified instead of reduced
- Returns:¶
dict[str, Any] – Dictionary of flattened values with the keys reformatted as a hierarchical tuple of strings
int – Size of the values in the flattened dictionary
dict[str, list[str]], Optional – Dictionary containing dropped keys and reason(s) for dropping