Skip to content
Advertisement

python remove duplicates from a list of list with uneven distribution

i have a python list of lists i want to merge all the containing list with at least 1 common element and remove the similar items

i have a big set of data which is a list of lists, with some common data in some of the containing lists, i want to merge all lists with common data

JavaScript

the elements containing even one common element they are grouped together

the original data file is this

Edit

this is what i am trying

JavaScript

NOTE – the largest number present in the data will be equal to the length of list of lists

Advertisement

Answer

A simple (and probably non-optimal) algorithm that modifies the input data in place:

JavaScript
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement