如何合并3个不同的熊猫数据框?

时间:2020-10-13 19:22:01

标签: python pandas dataframe pandas-groupby multi-index

我有3个pandas数据框:

abc
xyz
colour
type
pattern
colour
type
pattern
lenght
breadth
height
area
lenght
breadth
height
area

我想合并数据帧,使其看起来像这样:

abc colour   length
    type     breadth
    pattern  height
             area 
xyz colour   length
    type     breadth
    pattern  height
             area

我还想将最终结果导出到Excel工作表中,那么如何在不使它看起来混乱的情况下做到这一点?

1 个答案:

答案 0 :(得分:0)

第一concat第二和第三df与第一df的行,并连接它们:

FactoryClass