我有两个熊猫DataFrames:
df1
key id count
100 9821 7
200 9813 10
df2
nodekey nodeid
100 9821
200 9813
如果df2中的nodekey + nodeid与df1中的key + id相匹配,则df1中的count必须设置为0。
key id count
100 9821 0
200 9813 0
我尝试了以下操作(仅在键和节点键上进行匹配,作为测试),但是收到错误消息:
df1['count']=np.where((df1.key == df2.nodekey),0)
ValueError: either both or neither of x and y should be given
有什么建议吗?
茅侃侃
炎炎设计
相关分类