I have four lists contain different numbers as shown below:
list1 = [399826, 399827, 413350, 404450, 399827, 404451]
list2 = [399825, 399826, 412450, 403650, 391227]
list3 = [412450, 399827]
list4 = [399829, 399246, 513350, 404370, 789827, 439931, 404451]
Regarding the lists there are overlaps between the lists. I am going to make a dataframe which shows a set of all numbers and the name of lists that they belong to. Like this:
| numbers | list1 | list2 | list3 | list4 |
|---|---|---|---|---|
| 399826 | True | True | False | False |
| 399827 | True | False | True | False |
| 413350 | True | False | False | False |
| 412450 | False | True | True | False |
| etc | ... | ... | ... | ... |
For comparing the lists I used a function here:
def returnNotMatches(a, b):
a = set(a)
b = set(b)
return list(b - a)
But I don't know how I can make the dataframe correctly.