Below is in which I have data.
a = [{'ID': 319684283, 'ID1': 1025018, 'date': '2018-01-07 17:39:46', 'rate': 9.639e-05, 'amount': 410.84392747, 'total': 0.03960124, 'order': 16532584965, 'type': 'A', 'category': 'website'}, {'ID': 319684282, 'ID1': 1025017, 'date': '2018-01-07 17:39:46', 'amount': 24.84386425, 'total': 0.00239445, 'order': 16532584965, 'type': 'phone', 'category': 'exchange'}, {'ID': 319684281, 'ID1': 1125117, 'date': '2018-01-17 17:39:16', 'amount': 14.8138145, 'total': 0.10239445, 'order': 16512581965, 'type': 'phone', 'category': 'exchange'}]
How do I pull record which is latest of these. I tried
for c in a:
print(min(c['date']
It failed as it is not able to traverse all the elements. How do I achieve the below out put, limited values:
d = { 'date': '2018-01-17 17:39:16', 'amount': 14.8138145, 'total': 0.10239445, 'order': 16512581965}
Here d should have only the latest value based on date.