I have a dataframe and want to compare multiple columns of different rows and count the number of cases where both conditions are fullfilled.
Since my actual dataframe is pretty large, here's an example to simplify what I want to do:
In the linked picture, you can see the simplified example. I want to count all cases where the age of Person A and B is the same and the current job of Person A is the same as the past job of Person B. This should return count=1 since Thomas and Ryan have the same age and Ryan's current job is the same as Thomas' previous job.
I hope my question is understandable and this is possible