I have 3 different dataframes that I want to join, using label and window as keys.
DataFrame1
Window  Label  FeatA
123      1        h
123      2        f
DataFrame2
Window  Label  FeatB
123      1      d 
123      2      s
DataFrame3
Window  Label  FeatC
123     1       d
123     2       c
Result
Window  Label  FeatA  FeatB  FeatC
123      1       h      d       d
123      2       f      s       c
I know how to join dataframes using pandas.concat but don't know how to specify keys. Any help would be greatly appreciated.
A pure pandas answer using pd.concat
pd.concat([df.set_index(['Window', 'Label']) for df in [df1_, df2_, df3_]],
          axis=1).reset_index()

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With