How to sort two unordered columns which may or may not have same ID number and provide the information if they match or do not in the third column.(Kindly refer the expected output for better understanding.
Sample Data:
ID1 ID2
e0a8d3c0 fa266db6c0b6
233b-1038-8703 e0a8d3c0
fa266db6c0b6 f8814840
f8814840 233b-1038-8703
93d17740
I want to reorder the "ID2" column exactly with "ID1" column and add an additional column if they "Match" or "No Match". If the ID is not in ID2 column then it should show "No ID".
As I am new to python. I am still trying to figure out how to do that.
Based on the links provided:
I tired as below:
df_m['Match No Match'] = (df_m['ID1'] == df_m['ID2']).astype(int)
(This gives a very vague answer and does not help to sort the 'ID2' column based on the 1st Column('ID1')
ID ID2 Match/No Match
e0a8d3c0 e0a8d3c0 Match
233b-1038-8703 233b-1038-8703 Match
fa266db6c0b6 fa266db6c0b6 Match
f8814840 f8814840 Match
93d17740 No ID No Match