I have an OrderedDict that each key has more than one value.
<key, value1, value2, value3>
< 1, 50 , 1000, 20 >
< 3, 40 , 2000, 2 >
< 5, 30 , 10000, 70 >
..
How can I get the key of the item that has the minimum value3? for this example, the minimum value3 would be 2. So, I want to have:
< 3, 40 , 2000, 2 >
or the key which is 3
If the values of the ordered dictionary are a tuple or list, you can use:
d = {1: (50, 1000, 20), 3: (40, 2000, 2), 5: (30, 10000, 70)}
min(d.items(), key=lambda x: x[-1][-1])