What would be the most efficient way to sum across dictionaries within a large dictionary in Python?
I am finding similar posts, but not exactly what I am looking for. For example, there is a post for dict in a list: Python: Elegantly merge dictionaries with sum() of values. There are other stuffs too, but not exactly for dict within a dict.
Example code would be:
a={}
a["hello"]={'n': 1,'m': 2,'o': 3}
a["bye"]={'n': 2,'m': 1,'o': 0}
a["goodbye"]={'n': 0,'m': 2,'o': 1}
And the output I need would be:
{'n': 3,'m': 5,'o': 4}
Please, help! Many thanks!