i have a problem that i cannot reach a solution, this is my dataset:
data = [[2022-06-01, 'John', 'A'], [2022-06-02, 'John', 'D'],
[2022-06-03, 'John', 'D'], [2022-06-01, 'Sara', 'D'],
[2022-06-02, 'Sara', 'D'], [2022-06-01, 'Lucas', 'A'],
[2022-06-02, 'Lucas', 'A'], [2022-06-01, 'Mike', 'D'],
[2022-06-02, 'Mike', 'A'], [2022-06-03, 'Mike', 'D']]
df = pd.DataFrame(data, columns=['Date', 'Name', 'Label'])
I just want to choose rows with D label that don't have an 'A' before the 'D' in each name, my real problem probably has more than 70 rows with each name and i need all the 'D' that match that condition, for example, the solution of this problem is:
Date Name Label
2022-06-01 Sara D
2022-06-02 Sara D
2022-06-01 Mike D
I need help because i didn't find any good aproach to see how i deal the problem, thank you for your help!