nip.utils.data.unflatten_dict_keys

nip.utils.data.unflatten_dict_keys#

nip.utils.data.unflatten_dict_keys(flat_data: dict, separator: str = '.') dict[source]#

Unflatten a dictionary to a nested by splitting keys by a separator.

Creates a nested dictionary structure from a flat dictionary where keys are joined by a separator. E.g. {“a.b.c”: 1} becomes {“a”: {“b”: {“c”: 1}}}.

Parameters:
  • flat_data (dict) – The flat dictionary to unflatten.

  • separator (str, default=".") – The separator used to join keys in the flat dictionary.

Returns:

nested_data (dict) – The nested dictionary with keys split by the separator.