Deleting rows based on values in other rows
问题 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