Skip to content
Advertisement

Joining two dataframes on columns they match

I have two dataframes. df1 has more elements (3) in column ‘Table_name’ than df2 (2). I want a resultant dataframe that only outputs the rows where df1 and df2 share the same column names.

df1

JavaScript

df2

JavaScript

I want this to be the result.

df_result

JavaScript

This is what i tried but it doesn’t work:

JavaScript

Advertisement

Answer

You need loc here

JavaScript
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement