How to increase the speed of CSV data matching?

Try using python's "set difference" to find the elements in set A that do not have a match in set B:

def res():
    fset = set(fk())
    pset = set(pk())
    print('items in F that are missing from P:')
    print(fset - pset)