0

I have a situation where I want to match some indices in one dataframe to there corresponding ids in another dataframe. My df1 looks like this :

  id
0 1
1 2
2 3
3 4

my df2 looks like this :

  id_df2
0 1234
1 2222
2 3333
3 3344

Now I want to match the index columns in both the data frames and get the value from df2. The output should look like this :

  id id_df2
0  1   1234
1  2   2222
2  3   3333
3  4   3344

The thing is to match the pandas index columns that represents the row index for both the data frames. Net net I want to perform the following:

Match pandas default index column from df1 to pandas default index column in df2 to get the id from df2

Django0602
  • 797
  • 7
  • 26

0 Answers0