After scraping a web table, I stored all the values for each row as a dictionary and then appending all the dictionaries in a list. In doing so, I get below dictionaries (sample) which can have the same key-value pairs, Eg: store
123
& 789
are present in 2 dictionaries:
${data} = [{store: 123, prov: 'ON' value: 10},{store: 456, prov: 'AB' value: 5},{store: 123, prov: 'ON' value: 4},{store: 789, prov: 'MB' value: 3},{store: 789, prov: 'MB' value: 7}]
How can i merge and sum value
of all these dictionary items in order to get only unique elements like:
${data} = [{store: 123, prov: 'ON' value: 14},{store: 456, prov: 'AB' value: 5},{store: 789, prov: 'MB' value: 10}]
The solution can be provided using python as well.
Note: I found some python solutions but they only work when each dictionary is stored as a separate variable Merge and sum of two dictionaries