i am looking to apply multiply masks on each column of a pandas dataset (respectively to it's properties) in python. In the next step i want to find (a) row(s) in the dataframe that fits all conditions. therefore i have:
df
Out[27]:
DE FL GA IA ID
0 0 1 0 0 0
1 1 0 1 0 1
2 0 0 1 0 0
3 0 1 0 0 0
4 0 0 0 0 0
mask_list = []
for i in range(0,5):
if i % 2==0:
mask_list.append(df[[i]]>0)
else:
mask_list.append(df[[i]]<1)
concat_frame = pa.DataFrame()
for mask in mask_list:
concat_frame =pa.concat((concat_frame, mask), axis=1)
concat_frame
Out[48]:
DE FL GA IA ID
0 False False False True False
1 True True True True True
2 False True True True False
3 False False False True False
4 False True False True False
[5 rows x 5 columns]
update
expected outcome:
outcome
Out[60]:
DE FL GA IA ID
1 1 0 1 0 1
Here comes the question :
how can i apply the concat_mask on df , so that i select rows, in which all Boolean criteria are matched (are True)?