I have two dictionaries I want to merge using both keys and values. The first is an ordered dictionary, while the second is a regular one. Both dicts have the same length.
ord_dict = OrderedDict([(0, 369670), (1, 370622), (2, 267034), ...])
reg_dict = {0: (0, 0), 1: (0, 1), 2: (0, 2), ...}
The desired result is a new dict where the key is the tuple of reg_dict
and the value is the second element of each tuple in ord_dict
.
In this example, the result should look like this:
merged_dict = {(0, 0): 369679, (0, 1): 370622, (0, 2): 267034, ...}
How to do this?