0

I'm not sure how to do this. I have a table structured as following:

true_name   reference_name
abc         123
xyz         098

Another table with a column

true_name 
abc
abc
xyz

how can I use dataframe one to map all values in dataframe 2?

Lostsoul
  • 23,230
  • 42
  • 133
  • 217

1 Answers1

1

create key:value pair (dictionaty) of df1 columns using dict(zip()) and map over to df2.

df2['reference_name']=df2['true_name'].map(dict(zip(df1.true_name,df1.reference_name)))




    true_name  reference_name
0       abc             123
1       abc             123
2       xyz              98
wwnde
  • 22,093
  • 5
  • 13
  • 27