Looking for help in merging the following two data-frames.
df1:
key mean stddev
--- ----- -------
key1 30 3
key2 40 4
key3 50 5
df2:
key mean stddev
--- ----- -------
key2 70 7
key3 80 8
key4 90 9
The above two dataframes need to be merged to produce three different results:
1. Rows that are in df1 but not in df2:
key mean stddev
--- ----- -------
key1 30 3
2. Rows that are in both df1 and df2 (please see the new columns delta_mean(difference of mean), delta_stddev (difference of stddev)
key mean_x stddev mean_y stddev_y delta_mean delta_stddev
--- ----- ------- ------ -------- --------- -----------
key2 40 4 70 7 30 3
key3 50 5 80 8 30 3
Additionally, I would like to sort it by the delta_mean.
3. Rows that are in df2 but but not not in df1
key mean stddev
--- ----- -------
key4 90 9