3

I have following dataframe,

    mac1         mac2          uuid    val         refVal                                                                                                    
0   ac233fc01403 ac233f26492b  e2c56   [-42, -44]  [[-45, -54],[-72]]                                                                                 
1   ac233fc01403 e464eecba5eb  0.0     [-34, -56]  [[-56],[-34,-89]]  

I need to find an euclidean distance of "val" column with respect to each sublist of "refVal" column based on the groups of "mac1" & "mac2" and the resultant dataframe should be,

    mac1         mac2          uuid    val         refVal              euc_dist                                                                                                 
0   ac233fc01403 ac233f26492b  e2c56   [-42, -44]  [[-45, -54],[-72]]  [d1,d2]                                                                                 
1   ac233fc01403 e464eecba5eb  0.0     [-34, -56]  [[-56],[-34,-89]]   [d1,d2] 

I have tried with iterating the rows of df to get the list of "val" column and sublist of "refVal" in order to find the euclidean distance i.e.,

sqrt(sum((x - y)^2))

Can anyone help me out in this to resolve the same?

anu010291
  • 85
  • 1
  • 7

0 Answers0