You can use the subtract method and specify a fill_value zero:
A.subtract(B, fill_value=0)
Note: the method below, combineAdd , is deprecated from 0.17.0 onwards.
One way is to use the combineAdd method to add -B to A :
>>> A.combineAdd(-B) 0 a -2 b 2 c -4
Using this method, two DataFrames are added, and the values โโin non-matching indexes default to the value in A or B
source share