擅长:python、mysql、java
<p>我相信你需要:</p>
<pre><code>#get diffrence of matched columns, convert to absolute
df3 = df1[df2.columns].sub(df2.iloc[0]).abs()
#compare by minimal values, count them by sum
s = df3.eq(df3.min()).sum(axis=1)
#filter rows with maximal count
df = df1[s.eq(s.max())]
print (df)
Food Name Protein Calorie Carbohydrate Calcium
2 Butter oil 0.28 876 0.0 4.0
</code></pre>