【发布时间】:2014-10-19 01:24:55
【问题描述】:
我有以下 2 个数据框
Example1
sku loc flag
122 61 True
123 61 True
113 62 True
122 62 True
123 62 False
122 63 False
301 63 True
Example2
sku dept
113 a
122 b
123 b
301 c
我想使用 Pandas(或最好的 Python 运算符)执行合并或连接操作,以生成以下数据框。
Example3
sku loc flag dept
122 61 True b
123 61 True b
113 62 True a
122 62 True b
123 62 False b
122 63 False b
301 63 True c
Both
df_Example1.join(df_Example2,lsuffix='_ProdHier')
df_Example1.join(df_Example2,how='outer',lsuffix='_ProdHier')
不工作。 我究竟做错了什么?
【问题讨论】:
标签: python join pandas vlookup