One method with a pivot table:
df2 = df[list['abde']].copy() # take only the 4 columns needed
df2['e'] = df2['e'].astype(int) # transform True/False to 1/0
pt = df2.pivot_table(index=['a', 'b'], columns=['e'], values='d', aggfunc='min').fillna(0)
display(pt)
pt[1] has the values for the column f for a given ('a', 'b')
df['f_calc'] = df.apply(lambda row: pt[1].loc[row['a'], row['b']], axis=1)
display(df)