1

I have a df as df1

                       Userid         Price  
Time                                                        
2022-04-02 14:24:21  91127426  46697.000000 
2022-04-02 13:36:46  38041849  46901.500000  
2022-04-02 13:18:03  23796917  46770.000000 

and other df as df2

            price_diff_bps  pnl_of_fills  
Userid                                  
38041849            -0.0       -1333.0  
91127426            -0.0       -5687.5 

im trying to merge these two dataframes upon user id.

final_df=df2.merge(df1, left_index=True, right_on='Userid')
            

       Userid         Price  price_diff_bps  pnl_of_fills  
Time                                                        
2022-04-02 14:24:21  91127426  46697.000000  -0.0  -1333.0   
2022-04-02 13:36:46  38041849  46901.500000  -0.0  -5687.5 

im missing the user id in final df, i need all the userid from the df1.

Madan
  • 226
  • 2
  • 8

0 Answers0