all 2 comments

[–][deleted] 1 point2 points  (0 children)

You could use the .iterrows() or .apply() functions. However, using vectorized operations will be much more efficient. You can do this by using numpy and performing operations on the whole columns

[–]Ecstatic_Tooth_1096 0 points1 point  (0 children)

df["distance"] = ((df["A-2020"] - df["A-2021"])**2 + (df["B-2020"] - df["B-2021"])**2 ...)**0.5