iterate over pandas dataframe and update the value – AttributeError: can’t set attribute
First iterating in pandas is possible, but very slow, so another vectorized solution are used. I think you can use iterrows if you need iterating: for idx, row in df.iterrows(): if df.loc[idx,’Qty’] == 1 and df.loc[idx,’Price’] == 10: df.loc[idx,’Buy’] = 1 But better is to use vectorized solutions – set value by boolean mask with … Read more