I have a data frame with positional data stored like this:
r1_x r1_y r1_z r2_x r2_y r2_z
0 17.670965 19.857307 27.178185 17.555960 20.653801 27.641266
1 17.670965 19.857307 27.178185 16.950911 4.216056 12.901429
2 17.670965 19.857307 27.178185 11.737829 26.097181 3.230895
3 17.670965 19.857307 27.178185 16.254911 12.062716 12.170364
4 17.670965 19.857307 27.178185 16.504757 11.673612 12.406663
5 17.670965 19.857307 27.178185 16.717722 27.935490 28.795826
Here the x, y, and z denote the components of a 3d vector. What is the best way to go about performing vector operations on such a data frame element wise? For example, what if I wanted to calculate r2-r1 for each row, or take a dot product? I am using pandas to store this data.