我有两个数据框(df1和df2),在df1中,我存储了一行值集合,我想找到df2中最相似的行。
import pandas as pd
import numpy as np
# Df1 has only one row and four columns.
df1 = pd.DataFrame(np.array([[30, 60, 70, 40]]), columns=['A', 'B', 'C','D'])
# Df2 has 50 rows and four columns
df2 = pd.DataFrame(np.random.randint(0,100,size=(50, 4)), columns=list('ABCD'))
问题:基于df1,df2中哪一行最相似?