擅长:python、mysql、java
<p>改用<code>apply</code>:</p>
<pre><code>def func(x):
if (x.name % 1000) == 0:
print("Row node index: {}".format(str(x.name)))
caculated_id = get_id(row['name', row['sex']])
return caculated_id
df['id'] = df.apply(func, axis=1)
</code></pre>