I have two dataframes Df1 and Df2. I have merged Df1,Df2 on column a. Now I want to compare the same name columns of the merged dataframe and append in "miss_match" column if the values dont match.
eg: compare b_PE with b_PS, c_PE with c_PS. if the value of b_xx does not match and value of c_xx does not match then we will append mismatch column with b,c
similarly if value of b_xx match and value of c_xx does not match then we will append mismatch column with c
Df1
a b c
a '1' 1
2 '2' 5
c '3' 3
Df2
a b c
a '4' 0
2 '2' 2
c '6' 3
merged_df
a b_PE b_PS c_PE c_PS
a '4' '1' 0 1
2 '2' '2' 2 5
c '6' '3' 3 3
expected result:
a b_PE b_PS c_PE c_PS miss_match
a '4' '1' 0 1 b,c
2 '2' '2' 2 5 c
c '6' '3' 3 3 b
Any suggestions on this will be very helpful. Thanks