Skip to content

Utils

list_dict_to_dict_list(list_dict)

Convert from list of dictionaries to dictionary of lists.

Source code in dvc_render/utils.py
4
5
6
7
8
9
def list_dict_to_dict_list(list_dict):
    """Convert from list of dictionaries to dictionary of lists."""
    if not list_dict:
        return {}
    flat_list_dict = [flatten(d, reducer="dot") for d in list_dict]
    return {k: [x[k] for x in flat_list_dict] for k in flat_list_dict[0]}