擅长:python、mysql、java
<p>类似这样的东西可能就是你想要的:</p>
<pre><code>import pandas as pd
import numpy as np
# remove the c1 column from df2
df2.drop("c1", axis=1, inplace=True)
# merge the 2 dataframes and get the c1 values corresponding to c2
newdf = df.merge(df2, on="c2")
</code></pre>
<p>如果列中确实缺少值(即NAs和存在值的某些行,则解决方案将不同)</p>