I have these two dataFrames
data1 = [[1,'A'],[2,'B'],[3,'C'],[4,'D'],[5,'E']]
data2 = [1,1,1,1,2,5,4,3]
df1 = pd.DataFrame(data1,columns = ['one','two'])
df2 = pd.DataFrame(data2,columns = ['one'])
I want to map all values of df2 of column one with df1 of column two. In simple terms i want to use df1 as a dictionary. I want output like this for df2
one
0 A
1 A
2 A
3 A
4 B
5 E
6 D
7 C
I am doing this
df2['one']= df2['one'].apply(lambda x: df1.two[df1.one == x])
Which gives me output
one
0 A
1 A
2 A
3 A
4 NaN
5 NaN
6 NaN
7 NaN
All A is correct but why latter all are NaN?
