Python 2.7
This is a variation on Python: get key with the least value from a dictionary BUT multiple minimum values
I have a dictionary that looks like this:
dates = {
'first record': {
'first date': '1985',
'last date': '2000',
},
'second record': {
'first date': '1985',
'last date': '2012',
},
'third record': {
'first date': '1985',
'last date': '2000',
},
'fourth record': {
'first date': '2000',
'last date': '2014',
}
}
I am trying to retrieve the key(s) of the oldest record(s), where oldest means the earliest first date and earliest last date. In the above example, 'first record' and 'third record' would both be returned.
I'm having a hard time figuring out how to implement a solution using the itervalues/iteritems approach described in answers to similar (but less complex) questions. Could anyone offer some guidance?