Suppose i have a DataFrame objects like this:
age_diff result
1 0
-1 1
0 1
I want to replace negative values in column age_diff by applying to them abs function. Also, if value in age_diff is changed, value in column result should be switched(if it was 0 then to 1, else to 0).
After this transformation DataFrame, shown above, should look like:
age_diff result
1 0
1 0
0 1
Can, anyone, point me to how can i achieve this?