ListA = [['abc','15','2021-10-02 08:53:29'],
['def','10','2021-10-01 07:52:19'],
['abc','15','2021-10-02 09:53:29'],
['def','10','2021-10-01 06:52:19'],
['gfc','10','2021-10-01 07:52:19']]
ListB = ['abc','def']
Since ListB has 'abc' and 'def', the script should
compare subarrays in array A which have
"abc":- find the latest date. eg.
'2021-10-02 09:53:29' - remove subarray which has "abc" but the date is earlier than the latest date
- find the latest date. eg.
compare subarrays in array A which have
"def"a) find the latest date. eg.'2021-10-01 07:52:19'b) remove subarray which has"def"but the date is earlier than the latest date
The final output should be
A = [['def','10','2021-10-01 07:52:19'],
['abc','15','2021-10-02 09:53:29'],
['gfc','10','2021-10-01 07:52:19']]
How to do this in Python?