擅长:python、mysql、java
<p>您可以先对<code>bq_back_price</code>上的值进行排序,然后在每个组中取{<cd2>}。在</p>
<pre><code>In [218]: df.sort_values('bq_back_price').groupby('bq_market_id').head(2)
Out[218]:
bq_selection_id bq_balance bq_market_id bq_back_price
0 45094462 185.04 7278437 1.97
1 45094462 185.04 7278437 1.97
</code></pre>