I have a pandas DataFrame df
with a list of unique ids id
, and a DataFrame with master list of all known ids master_df.id
. I'm trying to figure out the best way to preform an isin
that also returns to me the index where the value is located. So if my DataFrame was
master_df
was
index id
1 1
2 2
3 3
and df
was
index id
1 3
2 4
3 1
I want something like (3, False, 1)
.
I'm currently doing an is in and then looking then brute forcing the lookup with a loop, but I'm sure there is a much better way to do it.