I am trying to match previous row value with a particular value using index number. But i don't know how to implement this. Could you please help me how to do this?
Example:
operator_type Operator
= None
= AND
= None
= OR
= None
= None
code i am trying:
for index, row in df.iterrows():
if row['Operator'] == None and row['operator_type'] == '=' and row['Operator'].(index-1).values != 'AND':
print('alka')
Error:
File "imed_cons_new.py", line 68
if row['and_or_not_oprtor'] == None and row['operator_type'] == '=' and row['and_or_not_oprtor'].(index-1).values != 'AND':
^
SyntaxError: invalid syntax