擅长:python、mysql、java
<h3><a href="https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.Series.fillna.html" rel="nofollow noreferrer">^{<cd1>}</a></h3>
<pre><code>df['nameAB'] = df['nameB'].fillna(df['nameA'])
print(df)
</code></pre>
<p><strong>输出</strong></p>
<pre><code> nameA nameB nameAB
0 martin NaN martin
1 peter NaN peter
2 john jhon jhon
3 tom tomX tomX
4 bill billX billX
</code></pre>