我有两个csv文件,都包含两列。
第一个文件包含产品ID,第二个文件包含序列号。
我需要查找第一个csv中的所有序列号,并在第二个csv中查找匹配项。结果报告将在单独的一列中显示匹配的序列号以及每个csv中对应的产品ID。
我尝试修改以下代码,但没有成功。
你会如何处理这个问题?
import pandas as pd
A=set(pd.read_csv("c1.csv", index_col=False, header=None)[0]) #reads the csv, takes only the first column and creates a set out of it.
B=set(pd.read_csv("c2.csv", index_col=False, header=None)[0]) #same here
print(A-B) #set A - set B gives back everything thats only in A.
print(B-A) # same here, other way around.