I have two data frames one contains the data second contains codes and their decode values. i want to match df1[code] with df2[code] and paste df2[value] in df1. it should be noted that my second data frame contains code and values once, its basically a sheet of codes and values but in first data frame the codes are repeating so the values column which will be pasted should represent the value every time when the code appears in df1[code] column.
| df1[code] | df2[code] | df2[value] |
|---|---|---|
| 234 | 000 | Three |
| 235 | 234 | Two |
| 238 | 238 | Four |
| 337 | 235 | Five |
i need as following:
| df1[code] | df1[value] |
|---|---|
| 234 | Two |
| 235 | Five |
| 238 | Four |
| 337 | Null |
basically translation of codes in one data frame from second data frame.
df1anddf2,df1.merge(df2,on='Code'). - anky