擅长:python、mysql、java
<p>也可以使用<code>apply</code>函数:</p>
<pre><code>df['Full Entry'] = df.apply(lambda x: np.NaN if pd.isnull(x[2]) else x[1], axis=1)
print(df)
</code></pre>
<p>输出:</p>
<pre><code> 0 1 2 Full Entry
1 10/1/2016 stringvalue 456.0 stringvalue
2 NaN anothersting NaN NaN
3 NaN and another NaN NaN
4 11/1/2016 more strings 943.0 more strings
5 NaN stringstring NaN NaN
</code></pre>