0

These are the tables that I am trying to match: table 1 and table 2

table1 = pd.DataFrame({'Name': ['Patrick', 'Amy', 'Krish', 'Jack']})
table2 = pd.DataFrame({'Name': ['Patrick', 'Patrick', 'Jack', 'Amy', 'Rachel', 'Kim', 'Amy'],
                       'Age': [20,19,19,18, 45, 32, 17],
                       'Number of Job Offer': [1,2,3,4, 5, 6, 8] })

This is the expected outcome: expected outcome

Can anyone please show me how I can get that in Python? Thank you

Wu Kris
  • 77
  • 8

1 Answers1

0

You can use pandas and load up your tables into dataframes then merge them. See here for more information about comparing rows

Should be something along the lines of

common = table1.merge(table2, how = 'inner' ,indicator=False)
Ryan Rau
  • 153
  • 1
  • 7