Skip to content
Advertisement

Process columns based on column names in another column

I like to select cells for processing by choosing column names contained in a different column. For clarity, input and output are given below. Column ‘a’ contains the column names for setting the value to None for each row. I tried to code as below but keep getting errors.

JavaScript

Input

JavaScript

Output

JavaScript

Advertisement

Answer

Check with mask and numpy boardcast

JavaScript

Or we try

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