对于下面的数据框,基于两个工厂中涵盖的颜色名称,寻求创建新列,如果颜色在两个工厂中都存在,则计数为1,否则为0:
df:
Color Plant
green1 1
blue2 1
red1 1
purple6 2
blue2 1
blue3 2
green1 2
green1 1
red2 1
purple6 1
期望输出:
Color Plant Spillover
green1 1 1
blue2 1 0
red1 1 0
purple6 2 1
blue2 1 0
blue3 2 0
green1 2 1
green1 1 1
red2 1 0
purple6 1 1