dict1 = [{"ID": "1", "name": "tim", "OID": "12"},
{"ID": "2", "name": "bob", "OID": "22"},
{"ID": "3", "name": "rob", "OID": "33"},
]
dict2 = [{"ID": "1", "name": "tim", "wrongkey": "no", "OID": "12"},
{"ID": "2", "name": "difname", "wrongkey": "no", "OID": "22"},
{"ID": "4", "name": "rob", "wrongkey": "no", "OID": "33"},
]
df1 = pd.DataFrame(data=dict1)
df2 = pd.DataFrame(data=dict2)
I need to find rows in dict2 that match on dict1 ID but not on any other column. Using columns names that exist in both dataframes. But also dropping the OID column.
End result: (ID and Name are in both dataframes so just end up with that)
ID name
0 2 difname