擅长:python、mysql、java
<p>您在<code>scoreq</code>函数中使用了列名作为参数,但它不是这样工作的。它应该接收常规参数</p>
<p>您有两个选项:将整行发送到<code>scoreq</code>,或仅发送相关值:</p>
<pre class="lang-py prettyprint-override"><code>def scoreq(row):
scoreq = row["...."]
...
return scoreq
df_3Var['scoreq'] = df_3Var.apply(scoreq)
</code></pre>
<p>或仅直接发送值:</p>
<pre class="lang-py prettyprint-override"><code>df_3Var['scoreq'] = df_3Var.apply(lambda row: scoreq(row["..."], row["..."]))
</code></pre>
<p>此外,您可能希望将<code>scoreq</code>函数中的数字作为数字而不是字符串处理:例如<code>scoreq += (row["PPXPRI"]==(-1))*-0.1786</code>和不<code>in</code></p>