I saw this example on the internet:
What I want to do is apply that logic but having a df like this: