I have two dataframes
df1:
| Ref | Call |
|:-----------|------------:|
| E/123 | Research |
| E/164 | Research |
| E/256 | Research |
| E/543 | Fellow |
| E/213 | Fellow |
| E/457 | Fellow |
df2:
| Ref | Grade | Person |
|:-----------|------------:|:------------:|
| E/123 | 6 | A.Smith |
| E/164 | 4 | P.Davies |
| E/256 | 4 | E.Carter |
| E/543 | 8 | D.White |
| E/213 | 9 | R.Daniels |
| E/457 | 2 | S.Conner |
I want to add a new column to df2
, which takes the 'Call'
column from df1
, and then matches the call
to the ref
number i.e.:
| Ref | Grade | Person | Call |
|:-----------|------------:|:------------:|:---------|
| E/123 | 6 | A.Smith | Research |
| E/164 | 4 | P.Davies | Research |
| E/256 | 4 | E.Carter | Research |
| E/543 | 8 | D.White | Fellow |
| E/213 | 9 | R.Daniels | Fellow |
| E/457 | 2 | S.Conner | Fellow |
Obviously my script is not as simple as the above example (i.e. it isnt in a nice order, it has to be matched ref
to ref
), so df1
is a list of ALL the grants we have and their respective call
, df2
is a 'random' sample which can be big or small.