I'm attempting to merge two datasets using a unique ID for clients that are present in only one dataset. I've assigned the unique IDs to each full name as a dictionary, but each person is unique, even if they have the same name. I need to assign each unique ID iteratively to each instance of that person's name.
example of the dictionary:
{'Corey Davis': {'names_id':[1472]}, 'Jose Hernandez': {'names_id': [3464,15202,82567,98472]}, ...}
I've already attempted using the .map() function as well as
referrals['names_id'] = referrals['full_name'].copy()
for key, val in m.items():
referrals.loc[referrals.names_id == key, 'names_id'] = val
but of course, it only assigns the last value encountered, 98472.
I am hoping for something along the lines of:
full_name names_id \
Corey Davis 1472
Jose Hernandez 3464
Jose Hernandez 15202
Jose Hernandez 82657
Jose Hernandez 98472
but I get
full_name names_id \
Corey Davis 1472
Jose Hernandez 98472
Jose Hernandez 98472
Jose Hernandez 98472
Jose Hernandez 98472