make_value_key#
- eoio.utils.dict_tools.make_value_key(input_iterable: list | dict, key: str) dict | list[source]#
Convert a list of dictionaries into a dictionary using value denoted by the key as a key name.
Example
input_iterable = [{“ID”: “name”, “value”: “John”, “units”: None}, {“ID”: “age”, “value”: “27”, “units”: “year”}] key = “ID” output = {“name”: {“value”: “John”, “units”: None}, “age”: {“value”: “27”, “units”: “year”}}
- Parameters:
input_iterable – dictionary or list to reformat
key – key of the value to use as a key for the dictionaries in a list