0

I have actually two tables : table1 and table2

The information in the table1 are :

            column1   column2       
2019-02-22      1        7        
2019-02-21      2        8       
2019-02-21      3        9       
2019-02-21      4       10        
2019-02-21      5       11        
2019-02-21      6       12        
 ...

The information in the table2 are :

              column3   column4          
Date                                                               
2019-02-22      13         19   
2018-12-04      14         20   
2018-12-06      15         21  
2018-12-07      16         22    
2018-12-10      17         23    
2018-12-11      18         24    
  ...

I would like to :

  • create a new table table3
  • compare the index of table1 and table2
    • if (index of table1) == (index of table2)
      • add the entire row of table1 and table2 to the table3

Example : As you can see the index in table1 == index in table2

output of table3:

           column1   column2   column3   column4 
2019-02-22      1        7        13        19
   ...

I know that :

  • I will have to use two loops to do the comparaison bewteen the index of table1 and index of table2
  • Use table1.index.iloc[...]==table2.index.iloc[...]

After my knowledge is unfortunately not enough developed to continue this process.

Could you please tell me the general process?

stefan
  • 49
  • 7

0 Answers0