0

If value in column A from one dataframe matches value in column B from another dataframe, create column C in first dataframe from values in column D from the second. Example:

>df1
A
1
2
3
4
5
3

>df2
B  C
4  cat1
3  cat2
6  cat3
1  cat4

Expected Output

>df1
A  Cat
1  cat4
2  
3  cat2
4  cat1
5 
3  cat2

The answer from this question helped. But how do I handle the non-matching case - df1['A']=2,df['Cat']=""?

BK0090
  • 49
  • 5

0 Answers0