计算 2 个数据帧之间的最小距离并估计一个数据帧中缺失点的位置

calculate the minimum distance between 2 dataframe and estimate the missing points location in one dataframe

估计数据帧:

index x y
1 0.47 0.46
2 0.44 0.46
3 0.41 0.45
4 0.38 0.45
5 0.35 0.45
6 0.33 0.44
7 0.30 0.43
8 0.30 0.39

real_dataframe:

index x y
1 0.46 0.463
4 0.40 0.453
5 0.37 0.455
6 0.34 0.450
7 0.32 0.448

目标:计算估计值与真实数据之间的最小距离,并将距离添加到不匹配的估计数据点以指示实际数据帧中缺失的位置

缺失可能位于dataframe的中间,在这种情况下(2,3和8)real_missing等于估计加上距离

index x y
2 0.44 plus d 0.46 plus D
3 0.41 plus d 0.45 plus D
8 0.30 plus d 0.39 plus D
import math
mindistance = []
mindistance_x = []
mindistance_y = []
l_list = []
for x, y in zip(data_test.x_center,data_test.y_center):
    #x = data_test.x_center[0]
    #y = data_test.y_center[0]
    dist = []
    dist_x = []
    dist_y = []
    for w,z in zip(Estimated.x_center,Estimated.y_center):
        distance = math.sqrt((x - w)**2 + (y - z)**2)
        dist.append(distance)
        dist_x.append(x-w)
        dist_y.append(y-z)
    l = np.argmin(dist)
    l_list.append(l)
    mindistance.append(dist[l])
    mindistance_x.append(dist_x[l])
    mindistance_y.append(dist_y[l])

#average_min_distance = mean(mindistance)
#average_min_distance