Skip to content
Advertisement

Passing multiple dataframes as arguments to a function

I have been scratching my head since morning on how to tackle this problem. I need to pass multiple columns from multiple dataframes to a function as arguments.

Example : Df1

A B C
1 11 111,333
2 22 222
3 33 nan

Df2

D E
a 111
b 333

Now, I want all the rows from Df2(col E) which are not present in the Df1 (Col C) along with DF1(A,B) concatenated.

The output I want is below:

newcol C
2_22 222

I have written below code snippet to do the same but I’m stuck at how to apply it to the dataframes.

JavaScript

it returns correct output when the strings are passed. But I’m stuck at how to pass the dataframes directly. The below code behaves weirdly and also the “nan” in the col C doesn’t get filtered out.

JavaScript

Please help.

Advertisement

Answer

JavaScript

Output

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