I have two data frames. df1
is like this:
ID Score
A NA
A NA
B NA
B NA
B NA
B NA
C NA
C NA
df2
looks like this:
Name Score
A 70
B 54
C 99
I want df3
to look like this:
ID Score
A 70
A 70
B 54
B 54
B 54
B 54
C 99
C 99
I was thinking of for looping over df1
and using the name to search in df2
, but a for
loop would take forever, given that my actual data frame has many rows.
Note that I want df3
to maintain the structure of df1
. A, B, and C should appear the same number of times.