I have one dataframe (df1):
Type CA AR Total
alpha 2 3 5
beta 1 5 6
gamma 6 2 8
delta 8 1 9
I have another dataframe (df2)
Type CA AR Total
alpha 3 4 7
beta 2 6 8
delta 4 1 5
How can I add the above two data frames to get the following output:
Type CA AR Total
alpha 5 7 12
beta 3 11 14
gamma 6 2 8
delta 12 2 14
If I use a code along this line:
new_df = df1 + df2
I get the following error:
‘+’ only defined for equally-sized data frames
How do I add the two dataframes, perhaps by matching the names under the "type" column?
Thanks in advance!!