'verification existence of an row from a sheet in another one using python

hello everyone i just want ask if anyone has an idea how i can check if row exist from one sheet in other one and if not it will highlight the row i found the issue with verfication line by line i try this code

enter image description here

old = old.set_index('id')
new = new.set_index('id')
resultTest = pd.concat([old,new],sort=False)
result = resultTest.stack().groupby(level=[0,1]).unique().unstack(1).copy()
result.loc[~result.index.isin(new.index),'status'] = 'deleted' # is not new old 
result.loc[~result.index.isin(old.index),'status'] = 'added'     # is not old new
idx = resultTest.stack().groupby(level=[0,1]).nunique() # cell changed  
result.loc[idx.mask(idx <= 1).dropna().index.get_level_values(0),'status'] = 'modified'
result['status'] = result['status'].fillna('same')
result[result["status"] == 'deleted'].style.apply(highlight_max)


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source