for idx, row in df.iterrows(): if df.loc[idx,'Qty'] == 1 and df.loc[idx,'Price'] == 10: df.loc[idx,'Buy'] = 1
mask = (df['Qty'] == 1) & (df['Price'] == 10) df.loc[mask, 'Buy'] = 1