I have dataframe #1 looks like the following:
My second dataframe looks like the following:
So the first dataframe uses id and date as multiindex, while the second dataframe uses date and port as multiindex.
I managed to merge the two dataframes by firstly reset_index of both dataframes and then pd.merge(df1,df2,how='outer',on=['date','port'])
to achieve the following structure:
Lastly, I just set_index of this final structure using id and date and sort on id
My question: is there a way to merge the two dataframes WITHOUT resetting their multiindex, to achieve the structure I want with id and date still being the multiindex?