Pandas使用不同的索引将数据帧添加到一边

时间:2017-07-31 16:14:27

标签: pandas

我有这样的数据框:

        Sender                    USD_Equivalent
725     ABC                               5777527.31
330     CFE                               4717812.90
12      CDE                               3085838.19

        Sender                    USD_Equivalent
707     AAP                               1962412.94
149     EFF                               1777705.37
189     EFG                               1744705.37

我希望他们这样:

Sender     USD_Equivalent   Sender   USD_Equivalent
 ABC         5777527.31      AAP       1962412.94
 CFE         4717812.90      EFF       1777705.37
 CDE         3085838.19      EFG       1744705.37

由于

1 个答案:

答案 0 :(得分:4)

pd.concat([d.reset_index(drop=True) for d in [df1, df2]], axis=1)

  Sender  USD_Equivalent Sender  USD_Equivalent
0    ABC      5777527.31    AAP      1962412.94
1    CFE      4717812.90    EFF      1777705.37
2    CDE      3085838.19    EFG      1744705.37