I'm trying to extract rows from a df based on multiple conditions, ALL of the conditions must be met before any rows are selected else nothing.
My df
columns = ['is_net', 'is_pct', 'is_mean', 'is_wgted', 'is_sum']
index = ['a','b','c','d']
data = [['True','True','False','False', 'False'],
['True','True','True','False', 'False'],
['True','True','False','False', 'True'],
['True','True','False','True', 'False']]
df = pd.DataFrame(columns=columns, index=index, data=data)
df
is_net is_pct is_mean is_wgted is_sum
a True True False False False
b True True True False False
c True True False False True
d True True False True False
My conditions which must be in this format:
conditions = {'is_net': 'True',
'is_pct': 'True',
'is_mean': 'False',
'is_wgted': 'True',
'is_sum': 'False'}
Expected output:
is_net is_pct is_mean is_wgted is_sum
d True True False True False