Skip to content
Advertisement

Merge two rows and put the results in the same columns

I would like to join two files by key but I would like some columns to be joined together for example:

File1:

JavaScript

File2:

JavaScript

I would like to merge with primary key List (from file1) and Cod (from file2), to get:

JavaScript

I think we need something like a left join and an agragation but I don’t know how. In the final table I would like that in the values ​​not found there was a . While I would like a | to separate values ​​in “aggregated” columns

Which is the best way?

Advertisement

Answer

Idea is use DataFrame.explode by splitted values of List, then use left join and aggregate first values with join for expected ouput:

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