I have a Pandas dataframe where the values are lists:
import pandas as pd DF = pd.DataFrame({\'X\':[[1, 5], [1, 2]], \'Y\':[[1, 2, 5], [1, 3, 5]]}) DF
Or you can try set
set
DF['x_sub_y']=DF.X+DF.Y DF['x_sub_y']=DF['x_sub_y'].apply(lambda x : list(set(x)))==DF.Y DF Out[691]: X Y x_sub_y 0 [1, 5] [1, 2, 5] True 1 [1, 2] [1, 3, 5] False