回答此问题可获得 20 贡献值,回答如果被采纳可获得 50 分。
<p><strong>df1:</strong></p>
<pre><code>df1=pd.DataFrame({'id':['val1','val2','val3','val4','val5','val6'],
'min':['10','10','75','42','20','50'],
'max':['93','43','122','80','30','105']})
</code></pre>
<p><strong>df2:</strong></p>
<pre><code>df2=pd.DataFrame({'id':['val1','val2','val5','val1','val5','val2'],
'check':['55.4','35.8','93','11.5','23.8','3.22']})
</code></pre>
<p>目标是当id与<strong>df1</strong>匹配时,对<strong>df2</strong>中相应的检查列值求和,检查结果和是否在df1中的<strong>min-max</strong>范围内,并更新df2</strong>的<strong>结果列中的值</p>
<p><strong>输出df:</strong></p>
<pre><code>id check result
val1 55.4 positive
val2 35.8 positive
val5 93 positive
val3 10.1 negative
val1 11.5 positive
val5 23.8 positive
val2 3.22 positive
</code></pre>
<p>非常感谢</p>