I have two dataframes: df1 has 14k rows with missing rows and df2 has 100k rows of complete rows.
df1:
combo main main_cost rating
1 burger_coke burger 8 great
2 burger_fries burger 7 fine
3 steak_cheese steak okay
4 steak_mash steak awesome
5 salad_dressing salad
6 salad_fruit salad 5 great
7 pizza_rolls pizza 3 fine
8 pizza_bagels pizza 13
9 pizza_veg pizza great
df2:
have_it main main_cost rating distance(mi)
1 TRUE burger 8 great 20
2 FALSE burger 7 fine 56
3 TRUE steak 4 okay 30
4 FALSE steak 7 awesome 19
5 TRUE salad 10 decent 78
6 FALSE salad 5 great 66
7 FALSE pizza 3 fine 12
8 TRUE pizza 13 bad 14
9 FALSE pizza 11 great 40
I would like to merge the two into the smaller dataframe as the "combo" column is the key I am using. I only want to append the new columns and fill in the rows where there were missing values. I believe the join would be on the "main" column as it is the only column where nearly every value in df2 exists in df1. Ideally, I would like to end up with something like this:
df3:
combo main main_cost rating distance(mi) have_it
1 burger_coke burger 8 great 20 TRUE
2 burger_fries burger 7 fine 56 FALSE
3 steak_cheese steak 4 okay 30 TRUE
4 steak_mash steak 7 awesome 19 FALSE
5 salad_dressing salad 10 decent 78 TRUE
6 salad_fruit salad 5 great 66 FALSE
7 pizza_rolls pizza 3 fine 12 FALSE
8 pizza_bagels pizza 13 bad 14 TRUE
9 pizza_veg pizza 11 great 40 FALSE
I have tried all kinds of merges and joins but keep ending up with a huge df containing NA's where I want the filled in values.