I have 2 dictionaries that I need to combine.
dict_a = {'key1':[40,70],'key2':[35,76],'key4':[45,90]} dict_b = {'key1':[38,72],'key3':[37,89.56],'key4':[47,88]}
And I want a third dictionary, so that it combines both and assigns mean values ββfor identical keys.
dict_c ={'key1':[39,71],'key2':[35,76],'key3':[37,89.56],'key4':[46,89]}
Please note the following:
1. Each key has a list value with two items.
2. The values ββin the list can be int or float .
3. The value for Identical keys gets the average value as: key1: [39,71], etc.
source share