Skip to content
Advertisement

Creating new column from existing columns

I have a data-frame

JavaScript

I want to make a new column titled P_3 such that:

JavaScript

My conditions are:

JavaScript

I have applied the following codes:

JavaScript

But it gives me the following error:

JavaScript

Advertisement

Answer

In summary, your unique condition is:

JavaScript

combine_first: update null elements with value in the same location in other (ref: Pandas doc.)

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