Using Python 3.8, pandas 1.1.2
I have two dateframes with multiindex
df1 (multi level column):
user price
count sum
name date hour
A 9/17 1 33 34
A 9/17 2 66 55
A 9/17 3 77 2
A 9/17 4 88 1
df2:
seller_count
name date hour
A 9/17 1 100
A 9/17 15 66
I am trying to do full outer join on two of them.
Desired output:
user price
count sum seller_count
name date hour
A 9/17 1 33 34 100
A 9/17 2 66 55 null
A 9/17 3 77 2 null
A 9/17 4 88 1 null
A 9/17 15 Null Null 66
I am trying to find out a way to do this without resetting indexes. Any help? Thanks!
solution from Pandas Dataframe Multiindex Merge does not seem to work, I am only able to get seller_count
if it has same name, date,hour
as df1.
df1.columns outputs:
MultiIndex([( 'user', 'count'),
( 'price', 'sum')])
df2.columns outputs:
Index(["seller_count"])