I have two dataframes that I want to sum along the y axis, conditionally.
For example:
df_1
a b value 1 1 1011 1 2 1012 2 1 1021 2 2 1022
df_2
a b value 9 9 99 1 2 12 2 1 21
I want to make df_1['value'] -= df_2['value'] if df_1[a] == df_2[a] & df_1[b] == df_2[b], so the output would be:
OUTPUT
a b value 1 1 1011 1 2 1000 2 1 1000 2 2 1022
Is there a way to achieve that instead of iterating the whole dataframe? (It's pretty big)