<p>你可以用<a href="http://pandas.pydata.org/pandas-docs/stable/generated/pandas.merge.html" rel="nofollow">^{<cd1>}</a>。我认为<code>size2</code>中的第一个值是<code>M</code>,因为max<code>weight</code>是{<cd5>}。在</p>
<pre><code>df = pd.DataFrame({'size': list('SSMMMLS'),
'weight': [8, 10, 11, 1, 20, 14, 12],
'adult' : [False] * 5 + [True] * 2})
print df
adult size weight
0 False S 8
1 False S 10
2 False M 11
3 False M 1
4 False M 20
5 True L 14
6 True S 12
print df.groupby('adult').apply(lambda subf: subf['size'][subf['weight'].idxmax()]).reset_index(name='size2')
adult size2
0 False M
1 True L
print pd.merge(df, df.groupby('adult').apply(lambda subf: subf['size'][subf['weight'].idxmax()]).reset_index(name='size2'), on=['adult'])
adult size weight size2
0 False S 8 M
1 False S 10 M
2 False M 11 M
3 False M 1 M
4 False M 20 M
5 True L 14 L
6 True S 12 L
</code></pre>