我有两个DataFrame
个对象:
df1
:columns = [a, b, c]
df2
:columns = [d, e]
我想将df1
与df2
合并,使用sql
中的pandas
等效内容:
select * from df1 inner join df2 on df1.b=df2.e and df1.b <> df2.d and df1.c = 0
答案 0 :(得分:1)
以下一系列步骤可以帮助您:
df1 = df[df1.c==0]
merged = df1.merge(df2, left_on='b', right_on='e')
merge = merged[merged.b != merged.d]