【发布时间】:2020-09-28 13:12:58
【问题描述】:
我有两个结构如下的表:
Table 1
ID City Country
1 India
2 Delhi
3 America
4 New York
5 Germany
Table 2
ID Country City
1 India
2 India Delhi
3 America
4 America New York
5 Germany
Select * from table1
Left outer join table2
on citycountry = city or citycountry = country
我的任务是在 pandas 中实现相同的多个连接条件 "citycountry = city or citycountry = country"。我应该如何在 pandas 中做到这一点?
【问题讨论】:
标签: python pandas dataframe merge