Assuming I understood your question correctly and you want to drop the entire row if your specified conditions holds, you can write them as masks like

cond1 = origin['region'].isin(['US', 'UK', 'AUS'])
cond2 = origin['language'] == 'en'

Combining them (you want at least one of the conditions to be true in order to keep a row) with | you get

result = origin[cond1 | cond2]

Of course, this can also be written in a single line if you care to do so:

result = origin[(origin['region'].isin(['US', 'UK', 'AUS'])) | (origin['language'] == 'en')]

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top