0

Say that I have 2 dataframe (df1 & df2)

df1

DF1 = ID     Name     Age
      A     Bob       20
      B     James     23
      C     Felicia   33
      D     John      21
      B     Anita     41


DF2 = ID     Education       Title
      A      Junior High     Junior
      B      Senior High     Senior
      C      College         Bachelor
      D      University      Master

I want to merge/join/lookup/map (I don't know what I should use) so it will produce a df3 like this:

DF = ID     Name     Age     Education         Title
      A     Bob       20     Junior High       Junior
      B     James     23     Senior High       Senior
      C     Felicia   33     College           Bachelor
      D     John      21     University        Master
      B     Anita     41     Senior High       Senior

As you can see, I use 'ID' column as the index. How do I merge these 2 dataframes? I know the example data doesn't make sense but let's not focus on that!

Gerald Tambunan
  • 109
  • 1
  • 1
  • 9

0 Answers0