Applying conditional statements on lists stored in Dataframe cell

I would like to create a column that is the result of boolean logic of list stored in other column. import pandas as pd import numpy as np d = {‘202201’: [7180516.0, 4868058.0], ‘202202’: [433433740.0, 452632806.0], ‘202203’: [5444119.0, 10000000.0]} df = pd.DataFrame(data=d) #Storing Values in List df[‘seq’] = df.agg(list, axis=1) #Or #df[‘seq’] = df.agg(np.array, axis=1)… Read More Applying conditional statements on lists stored in Dataframe cell

What's wrong with this list comprehension?

I have listA=[[0,1],[1,2]], and listB=[[0,1,2],[0,1,3],[0,2,3],[0,2,4]]. I want to find all elements b from listB such that b⊆a doesn’t hold and a⊆b doesn’t hold for all elements a from listA. Put it another way, my desired output is: listC=[[0,2,3],[0,2,4]]. I tried the following codes: import numpy as np listA=[[0,1],[1,2]] listB=[[0,1,2],[0,1,3],[0,2,3],[0,2,4]] listC=[b for b in listB if… Read More What's wrong with this list comprehension?