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
  • 25,013
  • 48
  • 144
  • 239

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
  • 26,119
  • 6
  • 18
  • 32