'How to apply a condition to the result of a dataframe.compare to a third dataframe?

I have a set of averages in two dataframes that I would like to compare. One dataframe is newer than the other. I only want to see the latest averages if they were changed, otherwise if there was no change in the averages then it doesn't matter. I'm using dataframe.compare to output the 'self' and 'other' columns.
I would like to take the result of the dataframe comparison and apply a condition in order to output a third dataframe.

Let's say 'self' is the latest grade average and 'other' is the previous grade average. How can I apply a condition like an 'if' statement or similar construct to compare the 'self' and 'other' columns to determine if for example, 'self' is greater then 'other,' then output 'self' to a third column or dataframe? I will entertain another approach, but ultimately, the result desired is a third column or third dataframe with the latest grade average if it's different from the earlier grade.

I'm sure it's something simple but I haven't figured it out yet.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source