I have two dataframes that I would like to concatenate column-wise (axis=1) with an inner join. One of the dataframes has some duplicate indices, but the rows are not duplicates
You can perform a merge and set the params to use the index from the lhs and rhs:
In [4]:
df1.merge(df2, left_index=True, right_index=True)
Out[4]:
b c
a
1 2 5
1 3 5
2 4 6
[3 rows x 2 columns]
Concat should've worked, it worked for me:
In [5]:
pd.concat([df1,df2], join='inner', axis=1)
Out[5]:
b c
a
1 2 5
1 3 5
2 4 6
[3 rows x 2 columns]