I'm working on an app that finds and highlight duplicates in excel files. I have the following code where I am just adding --> where there are duplicates.
import pandas as pd
import numpy as np
from openpyxl import Workbook
dftest1=pd.read_excel('files/test1.xlsx')
dftest2=pd.read_excel('files/test2.xlsx')
comparevalues = dftest1.values == dftest2.values
rows,cols=np.where(comparevalues==True)
for item in zip(rows,cols):
dftest1.iloc[item[0], item[1]] = '{} --> {}'.format(dftest1.iloc[item[0], item[1]],dftest2.iloc[item[0], item[1]])
dftest1.to_excel('./files/output.xlsx',index=True,header=False)
I tried using fill
but got the error that fill is read-only. How can I use styles or fill to highlight
duplicates?