【发布时间】:2014-09-10 18:08:00
【问题描述】:
import pandas as pd
from pandas import DataFrame
l=[(1,10),(2,5), (3,7)]
l2=[(1,5), (2,6), (3,8)]
l3=[(2,3), (1,9), (3,9)]
d1=DataFrame(l)
d2=DataFrame(l2)
d3=DataFrame(l3)
j1=d1.join(d2, how='left')
因错误而失败:异常:列重叠:Int64Index([0, 1], dtype=int64)
怎么了?发生了什么?
In [40]: d1
Out[40]:
0 1
0 1 10
1 2 5
2 3 7
In [41]: d2
Out[41]:
0 1
0 1 5
1 2 6
2 3 8
我需要的是使用第一列加入d1和d2,结果应该是,需要哪种DataFrame操作?
0 1 2
0 1 10 5
1 2 5 6
2 3 7 8
【问题讨论】: