I have the following problem: I have two pandas data frames of different length containing some rows that have common values and some that are different like this:
df1
df1.add(df2, fill_value=0)
or
df1.add(df2, fill_value=0).astype(int)
This does exactly what you want using arguments intended to solve this exact problem. I added astype(int) at the end to preserve int
astype(int)
int