擅长:python、mysql、java
<pre><code>d = df.dropna().set_index('source').target.to_dict()
df['new_target'] = df.target.apply(lambda x: d.get(x,x))
source target new_target
0 jan feb aug
1 mar apr jul
2 jun
3 feb aug nov
4 apr jul jul
5 oct dec may
6 aug nov nov
7 dec may may
</code></pre>