I want to find matches between two columns and highlight the results of both columns, in a pandas dataframes, so I did this code:
df=pd.DataFrame({'Name':['Zea mays','Zea mays subsp. mexicana','Zea mays subsp. parviglumis'],'ID':[1,2,3],'type':[1.1,1.2,1.3],
'Name.1':['Zea mays subsp. huehuetenangensis','Zea mays subsp. mays','Zea mays'],'ID.1':[1,2,3],'type.1':[1.1,1.2,1.3],
'Name.2':['Zea nicaraguensis','Zea luxurians','Zea perennis'],'ID.2':[1,2,3],'type.2':[1.1,1.2,1.3],
'Name.3':['Capsicum annuum','Capsicum frutescens','Capsicum chinense'],'ID.3':[1,2,3],'type.3':[1.1,1.2,1.3]})
def in_statements(s):
color = 'yellow'
if np.where(str(s.iloc[4]) == str(s.iloc[8])):
color = 'yellow'
else:
color = 'black'
return 'background-color: %s' % color
df.style.applymap(in_statements)
However, it gives me this error: " ("'str' object has no attribute 'iloc'", 'occurred at index Samples')"
This is an example of the input:
Can someone point me in the right direction? Thanks

