擅长:python、mysql、java
<p>下面是一个工作示例:</p>
<pre><code># Sample function that sums x and y, then append the field as string.
def func(x, y, z):
return (x + y).astype(str) + z
benchmark['new_field'] = benchmark.groupby('field_1')\
.apply(lambda x: func(x['x'], x['y'], x['field_1']))\
.reset_index(level = 0, drop = True)
</code></pre>
<p>结果:</p>
^{pr2}$