I have two data frames, let's say A
and B
. A
has the columns ['Name', 'Age', 'Mobile_number']
and B
has the columns ['Cell_number', 'Blood_Group', 'Location']
, with 'Mobile_number'
and 'Cell_number'
having common values. I want to join the 'Location'
column only onto A
based off the common values in 'Mobile_number'
and 'Cell_number'
, so the final DataFrame would have A={'Name':,'Age':,'Mobile_number':,'Location':]
a = {'Name': ['Jake', 'Paul', 'Logan', 'King'], 'Age': [33,43,22,45], 'Mobile_number':[332,554,234, 832]}
A = pd.DataFrame(a)
b = {'Cell_number': [832,554,123,333], 'Blood_group': ['O', 'A', 'AB', 'AB'], 'Location': ['TX', 'AZ', 'MO', 'MN']}
B = pd.DataFrame(b)
Please suggest. A colleague suggest to use pd.Join
but I don't understand how.
Thank you for your time.