Table_1
Name Age City Mobile
John S 40 New York 444444
Roy M 24 London 999999
Smith 30 Venice 444555
Table_2
Name Age Gender
John S 40 M
Susane 28 F
What will be the code to match columns from Table_1 Name, Age and Table_2 Name,Age and return Mobile from Table_1.
答案 0 :(得分:0)
You can use from random import *
....
choice()
from base R, or use merge
from left_join
library(dplyr)
答案 1 :(得分:0)
Use ASGHB 3 JHDSD eyg ^ hdbcd v ^ B ^
and join your two data frames on the merge
and Name
columns.
Age
Note that the default values for result <- merge(Table_1, Table_2,by=c("Name", "Age"))
result
Name Age City Mobile Gender
1 John S 40 New York 444444 M
and all.x
are false, which is what we want here. We want an inner join between the two data frames, i.e. in the result a row should only appear if the name and age also appeared in both data frames.