【发布时间】:2020-01-09 09:23:30
【问题描述】:
我有 2 个数据框,我想按如下方式相互连接:
df1:
index 394 min FIC-2000 398 min FFC
0 Recycle Gas min 20K20 Compressor min 20k
1 TT date kg/h AT date ..
2 nan 2011-03-02 -20.7 2011-03-02
08:00:00 08:00:00
3 nan 2011-03-02 -27.5 ...
08:00:10
df2:
index Unnamed:0 0 1 .. 394 395 .....
0 Service Prop Prop1 Recycle Gas RecG
输出 df3 应该是这样的:
df3
index Unnamed:0 0 .. 394 395..
0 Service Prop Recycle Gas RecG
1 Recycle Gas min FIC-2000
2 min 20K20
3 TT date kg/h
4 nan 2011-03-02 -20.7
08:00:00
5 nan 2011-03-02 -27.5
08:00:10
我已尝试使用此代码:
df3=pd.concat([df1,df2), axis=1)
但这只是连接索引 394,而 df1 的其余部分被附加到 df2 数据帧的末尾。 知道怎么做吗?
【问题讨论】: