There's probably a slicker way to put this together with np.where() or apply(lambda x: x....)
but really you just need to test if the returned value is is an empty dataframe/value, and if it is set your column to zero.
for idx in df.index:
if len(df.loc[(df.A>10)&(df.B<11)].C.values)==0:
df.loc[idx,"E"] = 0
else:
df.loc[idx,"E"]=df.loc[(df.A>10)&(df.B<11)].C.values
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…