Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

add a column while iterating rows pandas

for idx, row in df.iterrows():
    if  df.loc[idx,'Qty'] == 1 and df.loc[idx,'Price'] == 10:
        df.loc[idx,'Buy'] = 1
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #add #column #iterating #rows #pandas
ADD COMMENT
Topic
Name
6+9 =