Skip to content
Advertisement

Pandas merge only on where condition

Please help with logic on applying merge function only where condition is met.

In below example: merge should be applicable only when, np.where name = John, else show 0

JavaScript

Expected result: enter image description here

TIA

Advertisement

Answer

use merge and select the good rows of your df2.

JavaScript
Advertisement