I successfully added a cutoff option to get_close_matches in Pandas. For some reason when I add cutoff=0.7, when it outputs to my CSV, it reads as ['Name']. When it did not have the cutoff argument, it just outputted the match with no ['']. Below is my code. Any help would be appreciated!
import sys
import difflib
import csv
import pandas as pd
df = pd.read_csv(sys.argv[1])
List = df.list #.astype(str).values.tolist()
MappedID = df.Party.astype(str)
df['Name_r'] = MappedID.map(lambda x: (difflib.get_close_matches(x, List, cutoff=0.7)[:1] or [None][0]))
header = [ "List", "Party", "Name_r"]
df.to_csv(sys.argv[2], columns = header)
print(df.to_string())