Skip to content
Advertisement

How to output a new dataframe with mismatched columns from two dataframes

I want to have a function that creates a new dataframe from two dataframes. I want to show the mismatched columns based on id number and a given column. enter image description here dataframes as input:

JavaScript

expected output:

enter image description here

Advertisement

Answer

STEP 1 // add the table name Prefix on column name

JavaScript

STEP 2 // Concat both df

JavaScript

STEP 3 // Using lambda function findout which row second column does math if does match return True and print only DF rows where condition came True

JavaScript

STEP 4 // To achieve desire output

JavaScript

Output:

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