I am trying to filter a dataframe where some columns are lists. And I want to base the filter out elements that does not pass the condition.
For example:
import pandas as pd
df = pd.DataFrame({'col1':[10,20], 'col2': [[1,2,3],[3,4,5]], 'col3': [[False,False,True],[True,True,False]],'col4':[True,False]})
col1 col2 col3 col4
0 10 [1, 2, 3] [False, False, True] True
1 20 [3, 4, 5] [True, True, False] False
applying the filter
df_filtered = df.query("col2>2 & col3==True")
the output I expect
Thanks for the help!
