📜  根据来自另一个数据帧的值更新数据帧 - Python 代码示例

📅  最后修改于: 2022-03-11 14:46:17.795000             🧑  作者: Mango

代码示例1
In [27]:

df.loc[df.Name.isin(df1.Name), ['Nonprofit', 'Education']] = df1[['Nonprofit', 'Education']]
df
Out[27]:
  Name  Nonprofit  Business  Education
0    X          1         1          0
1    Y          1         1          1
2    Z          1         0          1
3    Y          1         1          1

[4 rows x 4 columns]