I have a df where there are duplicate rows in aggregate but in this form:
timestamp animal_1 animal_2
2020-06-28 14:28:57 dog fox
2020-06-28 14:28:57 fox dog
2020-06-29 18:28:57 dog fox
2020-06-29 18:28:57 fox dog
2020-06-30 17:35:57 dog fox
2020-06-30 17:35:57 fox dog
I only want to keep the rows that have a unique timestamp followed by a single combination of both animals. From the above df I would only want to return the following:
timestamp animal_1 animal_2
2020-06-28 14:28:57 dog fox
2020-06-29 18:28:57 fox dog
2020-06-30 17:35:57 dog fox
What matters is that I return the number of times these 2 animals have interacted.
I have tried multiple sorting, grouping options using pandas but have had no luck.