aixd.data.utils_data.reformat_dict_to_dictlist

aixd.data.utils_data.reformat_dict_to_dictlist(dct: Dict) List[Dict][source]

In the input dictionary, each key (e.g. corresponding to a data object name) contains a list of items (e.g. corresponding to individual samples). This method reformats split it into a list of dictionaries (e.g. so that each dictionary corresponds to one sample)

Parameters:

dct (Dict) – Dictionary containing collated data.

Returns:

List[Dict] – List of dictionaries split per sample.

Examples

>>> dct = {'a': [[1, 1], [7, 7]], 'b': [2, 8], 'c': [3, 9]}
>>> reformat_dict_to_dictlist(dct)
[{'a': [1, 1], 'b': 2, 'c': 3}, {'a': [7, 7], 'b': 8, 'c': 9}]