I have a pandas dataframe which I am storing some values of which I'm trying to quantify the symmetry across an axis. I.e., to sum the absolute difference in measured values across an axis with 'x' == 0
x y
0 -50 -6.24
...
49 -1 -5.05
50 0 0
51 1 -3.95
...
100 50 -5.66
So I want to calculate:
|-6.24 - -5.66| + ... + |-5.05 - -3.95|
That is, the sum of the absolute difference between each 'y' on opposite sides of the axis.
I'm able to do do this by putting in some for loops (very slow), or some janky pivot table stuff, but I'm wondering if there's a more clean/standard way of doing this in pandas?