I was looking for a way to drop rows from my dataframe based on conditions to be checked with values in another row.
Here is my dataframe:
product product_id account_status
prod-A 100 active
prod-A 100 cancelled
prod-A 300 active
prod-A 400 cancelled
If a row with account_status='active' exists for a product & and product_id combination, then retain this row and delete other rows.
The desired output is:
product product_id account_status
prod-A 100 active
prod-A 300 active
prod-A 400 cancelled
I saw the solution mentioned here but couldn't replicate it for strings.
Please suggest.