I want to create a new column and assign 0 or 1 based on the condition i.e. if transaction_amount is divisible 10. Transaction_amount is one of the columns from df.
Tried the below code but it is not working.
df = df.assign(whole_amt = lambda x: 1 if (x.transaction_amount%10==0) else 0,axis=1)
Source: Python Questions