I would like to know how to merge/concat two dataframes with similar columns and a few missing values while still being able to retain all the information. My dataframes look similar to this:
df1
Item ID Order ID Name Location
21 1 John IL
22 2 John LA
24 2 Ron LA
25 3 Ron LA
29 5 John IL
df2
Item ID Order ID Name Location Type
20 1 John IL cable
22 2 Ron LA cable
23 2 Ron LA Box
26 3 Ron LA cable
27 N/A N/A IL Box
29 5 John IL Box
What I want my dataframe to look like
Item ID Order ID Name Location Type
20 1 John IL Cable
21 4 John IL N/A
22 2 John/Ron LA Cable
23 2 Ron LA Box
24 2 Ron LA N/A
25 3 Ron LA N/A
26 3 Ron LA Cable
27 N/A N/A IL Box
28 N/A N/A N/A N/A
29 5 John IL Box
I have tried to do something similar to this
dataframes = [df1, df2]
merged = reduce(lambda left,right: pd.merge(left,right,on='Item ID', how='outer'), dataframes)
But the sorting of it is wrong or it leaves some information out as well as not filling in the missing values (Item ID: 28).