【发布时间】:2021-01-14 07:53:54
【问题描述】:
根据另一列的值在 pandas 中创建值的串联
我有 2 个数据框
df1
NAME CODE
andy a,d
roger b
danny d
cole
df2
CODE MATERIAL
a paper
b plastic
b metal
d wood
e glass
我想用材料列更新 df2 并在必要时连接
预期结果:
CODE MATERIAL NAME
a paper andy
b plastic roger
b metal roger
d wood andy, danny
e glass
我该怎么办?
【问题讨论】:
标签: pandas concatenation