dict_keys_same¶
-
sunpy.util.
dict_keys_same
(list_of_dicts)[source] [edit on github]¶ Makes sure that a list of dictionaries all have the same keys.
If a key is missing, it will be added but with a value of None.
- Parameters
list_of_dicts (
list
ofdict
) – A list containing each dictonary to parse.- Returns
list
– The list with each dict updated.
References
Examples
>>> l = [{'x': 42}, {'x': 23, 'y': 5}] >>> dict_keys_same(l) [{'x': 42, 'y': None}, {'x': 23, 'y': 5}]