I have this code:
test = {"number": ['1555','1666','1777', '1888'],
"order_amount": ['100.00','200.00','-200.00', '300.00'],
"number_of_refund": ['','','1666', '']
}
df = pd.DataFrame(test)
Which returns the following dataframe:
number order_amount number_of_refund
0 1555 100.00
1 1666 200.00
2 1777 -200.00 1666
3 1888 300.00
What would be the best solution to remove the row if the order number is refunded? I would want to remove the order row and the refund row.
Logic if df['number'].value is in df['number_of_refund']
and the amount of df['number'].value
is the opposite of the df['number_of_refund']
rows.
So the result in this case should be:
number order_amount number_of_refund
0 1555 100.00
1 1888 300.00