I have a dict and a dataframe like the examples v and df below. I want to search through the items in df and return the item that has the maximum number of field values in common with the values in the dict. In this case it would be item 3. I was thinking maybe using apply with a lambda function, or transposing the df. I just can't quiet get my head around it. If anyone has a slick way to do this or any tips they're greatly appreciated.
input:
v={'size':1,'color':red}
df:
item size color
2 2 red
3 1 red
Output:
3