Pandas: compare list objects in Series

Do not use list in cell, it creates a lot of problem for pandas. If you do need an object column, using tuple:

df.A.map(tuple).isin([(1,2)])
Out[293]: 
0     True
1    False
2    False
Name: A, dtype: bool
#df[df.A.map(tuple).isin([(1,2)])]

Leave a Comment