<p>将<a href="http://pandas.pydata.org/pandas-docs/stable/generated/pandas.Series.map.html" rel="nofollow noreferrer">^{<cd1>}</a>与<a href="http://pandas.pydata.org/pandas-docs/stable/generated/pandas.Series.combine_first.html" rel="nofollow noreferrer">^{<cd2>}</a>或<a href="http://pandas.pydata.org/pandas-docs/stable/generated/pandas.Series.fillna.html" rel="nofollow noreferrer">^{<cd3>}</a>一起使用:</p>
<pre><code>df2['somecol3'] = (df2['article_id'].map(df1.set_index('article_id')['col1'])
.combine_first(df2['somecol3'])
.astype(int))
print (df2)
article_id somecol3
0 30 11
1 6 5
2 22 1
3 5 2
4 3 3
5 61 8
6 7 1
</code></pre>
<hr/>
<pre><code>df2['somecol3'] = (df2['article_id'].map(df1.set_index('article_id')['col1'])
.fillna(df2['somecol3'])
.astype(int))
print (df2)
article_id somecol3
0 30 11
1 6 5
2 22 1
3 5 2
4 3 3
5 61 8
6 7 1
</code></pre>
<p>用<a href="http://pandas.pydata.org/pandas-docs/stable/generated/pandas.Series.update.html" rel="nofollow noreferrer">^{<cd4>}</a>溶液:</p>
<pre><code>df2['somecol3'].update(df2['article_id'].map(df1.set_index('article_id')['col1']))
print (df2)
article_id somecol3
0 30 11
1 6 5
2 22 1
3 5 2
4 3 3
5 61 8
6 7 1
</code></pre>