I have two data frames that look like this:
df_A:
ID x y
a 0 0
c 3 2
b 2 5
df_B:
ID x y
a 2 1
c 3 5
b 1 2
I want to add a column to db_B, which is the Euclidean distance between x, y coordinates in df_B from df_A for each identifier. Desired Result:
ID x y dist
a 2 1 1.732
c 3 5 3
b 1 2 3.162
Identifiers will not necessarily be in the same order. I know how to do this by going through the df_A lines and finding the corresponding identifier in df_B, but I was hoping to avoid using a for loop, as this will be used for data with tens of millions of lines. Is there a way to use the application, but on condition that it matches the identifiers?
Megan