I am trying to remove all the rows from a data frame where a certain condition is met in one column.
Lets say my data frame is this:
index 'Value 1' 'Grade'
1 10 2170A
2 15 2170B
3 10 NCR2170B
4 20 NCR2170A
5 30 NCR2170B
I want the output after filtering to be this
index 'Value 1' 'Grade'
2 15 2170B
3 10 NCR2170B
5 30 NCR2170B
I have tried many different variations of using list comprehension, looping through each row and evaluating. I can make it work when I use something along the lines of:
data_filtered = data[data['Grade'] == '2170B']
But this obviously misses entries like NCR2170B.
Whenever I try something like:
data_filtered = data['2170B' in data['Grade']]
I get Key Error: 'True'.
I feel like I am missing something very obvious here.
I have also tried using np.where but it just outputs an empty array.