I have two table with 2 primary keys on id and group_id
id group_id name
01 333 Ken
05 123 Tom
03 231 Mary
05 94 Brandy
.... more rows
id group_id name
05 123 Tom
03 231 Mary
05 94 Brandy
07 384 Jane
.... more rows
expected multilevel dataframe
df1 df2 df1 df2
group_id name
id
05 123 123 Tom Tom
03 231 231 Mary Mary
05 94 94 Brandy Brandy
I want to merge 2 tables with inner join on the primary key columns (id and group_id), but so far I can only do it for one column and it's complaining Shape of passed values is (5, 3012), indices imply (5, 2915) because I have duplicate ids.
pd.concat([df1.set_index('id'), df2.set_index('id')], axis='columns', keys=['df1', 'df2'],join='inner')