I have a main dictionary like this:
data = [{"key1": "value1", "key2": "value2", "key3": "value3"}, {"key1": "value1", "key2": "value5", "key3": "value6"}, {"key1": "value2", "key2": "value2", "key3": "value9"} ]
And i need to create a dictionary out of it assuming there is a unique combination of [value for "key1"] and [value for "key2"]:
i.e., i need to create a dictionary like:
result = [{"value1" {"value2" : "value3", "value5" : "value6"}}, {"value2" {"value2" : "value9"}}]
I’m not sure I understand exactly what you are looking for but here is a little program that will do something close to what you are describing. Please note that this question has nothing to do with any of the tags you have marked it with. It’s a basic algorithmic problem.
The output is the following: