python - Pandas join on columns with different names -


i have 2 different data frames want perform sql operations on. unfortunately, case data i'm working with, spelling different.

see below example thought syntax userid belongs df1 , username belongs df2. me out?

 # not working - assume syntax issue? pd.merge(df1, df2, on = [['userid'=='username', 'column1']], how = 'left') 

when names different, use xxx_on parameters instead of on=:

pd.merge(df1, df2, left_on=  ['userid', 'column1'],                    right_on= ['username', 'column1'],                     how = 'left') 

Comments

Popular posts from this blog

php - How to display all orders for a single product showing the most recent first? Woocommerce -

asp.net - How to correctly use QUERY_STRING in ISAPI rewrite? -

angularjs - How restrict admin panel using in backend laravel and admin panel on angular? -