I'd like to determine if the output number in the new column "Calculator" should be a 5 or a 6 depending on the [State] and [Original_Creditor]. When I look for values in one column of the df I can get a result, but when I search for two pieces of data, I receive a syntax error.
The code is:
df.loc(df[df['State'] == 'ID' & (df[df['Orignal_Creditor'].str.contains('Visa', case=False) == True, 'Calculator'] = '5'
df.loc(df[df['State'] == 'OR|WA' & (df[df['Orignal_Creditor'].str.contains('Visa', case=False) == True, 'Calculator'] = '6'
The error message states:
Input In [13] df = df.loc(df[df['State'] == 'ID' & (df[df['Orignal_Creditor'].str.contains('Visa', case=False) == True, 'Calculator'] = '5'
^
SyntaxError: invalid syntax
I appreciate any help, thanks!