I would like to select a subset of my dataframe which satisfies the following condition: I have a dataframe that shows the result of different tests of three students. As soon as one of the students gets the result "poor", they can't be considered for the experiment and need to be dropped from the dataset. My Dataframe looks like this:
import pandas as pd
data = {'Name': ['Peter', 'Peter','Anna', 'Anna','Anna', 'Max'],
'Result': ["Good", "Good", "Good", "Good", "poor", "Very Good"],
}
df = pd.DataFrame (data, columns = ['Name','Points'])
This means that I would first need to look who has done poor to then delete every row with that Person in it. My desired outcome in this example would be:
df_res = pd.DataFrame({'Name': ('Peter', 'Peter', 'Max', 'Max'),
'Result': ("Good", "Good", "Very Good")})
Can anyone help me here? Especially deleting all the rows with the corresponding names in it is an obstacle for me.