Reputation: 611
I have two DataFrame
objects:
df1
: columns = [a, b, c]
df2
: columns = [d, e]
I want to merge df1
with df2
using the equivalent of sql
in pandas
:
select * from df1 inner join df2 on df1.b=df2.e and df1.b <> df2.d and df1.c = 0
Upvotes: 1
Views: 225
Reputation: 42905
The following sequence of steps should get you there:
df1 = df[df1.c==0]
merged = df1.merge(df2, left_on='b', right_on='e')
merge = merged[merged.b != merged.d]
Upvotes: 1