Skip to content
Advertisement

Create Pandas DataFrame column which joins column names for any non na values

How do I create a new column which joins the column names for any non na values on a per row basis.

  • Please note the duplicate index.

Code

JavaScript

Example DF

JavaScript

Desired output is a new column which joins the column names for non na values as per col_names example below.

JavaScript

Advertisement

Answer

Try with dot

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