0

I have a simple dataset:

enter image description here

I want to delete the rows where count>1 when animal is cat or dog. So the output should look like:

enter image description here

Can I get the result in an efficient way? Thank you

1
  • 1
    Your sample output doesn't match your sample condition. Commented Mar 4, 2021 at 2:20

1 Answer 1

1
count_mask = dataset['count'] > 1 animal_mask = dataset['animal'].isin(['cat', 'dog']) dataset = dataset[~(count_mask & animal_mask)] 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.