I have a list of python dictionaries, looking like this:
[{key1: value1, key2: array1}, {key1: value2, key2: array2}, {key1: value3, key3: array3},...]
In my case, some of these dictionaries have the same value for key1, for example, value1 = value3. How can I end up getting an array of dictionaries that will look like this?
[{key1: value1, key2: array1+array3}, {key1: value2, key2: array2},...]
where "array1+array3" is a single array with appended elements of the original array1 and array3 arrays?
edit: this is not merging by key; each dictionary in the array has strictly the same structure: {key1: "some_string", key2: [an array]} - my problem is that I wish to "merge" them on the "some_string", so the [an array], the value of key2, will be concatenated with arrays from other dictionaries in the list that have the same "some_string" as value of key1.