I have a table with the following information
No of transactions | GST | Item cost GST inclusive |
---|---|---|
1 | 0 | 0.5 |
I wish to include an additonal column with the following logic
def incl(s):
if ((s['No of Transactions'] ==0) & (s['GST'] ==0)):
return s['Item Cost GST inclusive']
else:
return s['Item Cost GST inclusive']*0.9
df2['Item Cost GST exclusive'] = df2.apply(incl, axis=1)
I am getting the following table
No of transactions | GST | Item cost GST inclusive | Item cost GST exclusive |
---|---|---|---|
1 | 0 | 0.5 | 0.45 |
Logically when there is no GST, item cost GST inclusive does not get multlplied by 0.9, because there is no point in triggering the condition. Also generally in cases where 'no of transaction' is 0, there is no item cost at all.
I was expecting the following table
No of transactions | GST | Item cost GST inclusive | Item cost GST exclusive |
---|---|---|---|
1 | 0 | 0.5 | 0.5 |
I am not sure what went wrong in the logic. I am sure the logic is wrong. Please help.
I will appreciate any kind suggestions please.