I am trying to filter out rows based on two rows values. Most of the questions' solution that I see use the following approach:
df.loc[(df['A'] != 'yes') & (df['B'] != 'no')]
This filters the rows with a A and B different than one value, what I want to do is to filter rows where the columns have the values I am filtering, example:
Player | action | result
1 A B
2 B A
3 C A
4 A B
5 A C
In this example I want to remove rows that have action A
and result B
. Using the example above it would remove actions equal to A
and rows with result equal to B
. I want to remove actions A
that have result B
.
Output expected:
Player | action | result
2 B A
3 C A
5 A C
Probably I am making a lot of confusion here and this is straightforward. Anyhow, any help would be appreciated!
Regards