Skip to content
Advertisement

Pandas how to mege the list of columns with NaN?

I want to merge the columns that have the list objects.

The problem is, I need to remove duplicate parts.

How am I able to get the columns that have the merged list like below?

Source:

JavaScript

Expected:

JavaScript

Advertisement

Answer

JavaScript
JavaScript


You can use this code regardless of the size(column lengths, row lengths) of dataframes.


I edited some codes cuz I didn’t realize that I should concern the duplicate problems.

Advertisement