Categories
Mastering Development

Keeping duplicate tuple values if they are present inside separate tuples but only keeping unique tuple values if they are in the same tuple

I have a list of tuples: What I want to do is to keep only the entities which have unique numbers inside each tuple. dataset = [(‘made of iron oxide’, {‘entities’: [(12, 16, ‘PRODUCT’), (17, 20, ‘PRODUCT’), (15, 24, ‘PRODUCT’), (12, 19, ‘PRODUCT’)]}),(‘made of ferric oxide’, {‘entities’: [(10, 15, ‘PRODUCT’), (17, 20, ‘PRODUCT’), (624, 651, […]