I'm trying to drop the rows matching specific strings in specific columns. I mean delete the row if a "specific string is matched in column A" and as well as "specific string in column B"...so on.
For example,
Student Science English Maths
0 A Good Good Good
1 B Poor Bad Bad
2 C Avg Good Avg
3 D Poor Good Bad
4 E Poor Avg Avg
5 D Poor Good Good
In the above dataframe, I want to drop the rows where the column.Science=="Poor" & also column.Maths=="Bad".
So the desired output would be
Student Science English Maths
0 A Good Good Good
2 C Avg Good Avg
4 E Poor Avg Avg
5 D Poor Good Good
I tried
df = df[(~df.Science.str.match('Poor')) & (~df.Maths.str.match('Bad'))]
But it is dropping all the rows matching either of the conditions.
Student Science English Maths
0 A Good Good Good
2 C Avg Good Avg