I have two DataFrames that I want to merge . I read about merging multiple columns and keeping the index on merge . My problem should satisfy both, and itβs hard for me to figure out how to do this.
The first DataFrame looks like this:

and the second looks like

I want to combine them based on Date and ID . In the first, a DataFrame Date is an index, and ID is a column; in the second DataFrame, both Date and ID are part of MultiIndex .
Essentially, as a result, I want the DataFrame to look like a DataFrame 2 with an extra column for Events from DataFrame 1.
source share