I have a dictionary as follows:
{'similar_record_id': ['A-1','A-2','A-3','A-4','A-5'],
'idx_pair' : [[25, 26],[835, 836],[834, 836, 835],[67, 69, 68],[62, 68, 66, 69, 67, 65]
}
Here idx_pair will have a list of lists, here some of pairs are similar to another list of elements as follows -
[835,836] is existed in this [834,836,835] so merge it as [834,835,836]
[67,69,68] is existed in this [62, 68, 66, 69, 67, 65] so merge it as [62,68,66,69,67,65]
If any of element from a list is existed in another list they should be merged.
expected output as:
{'similar_record_id': ['A-1','A-2','A-3'],
'idx_pair' : [[25, 26],[834,835, 836],[62, 68, 66, 69, 67, 65]
}