I have two dataframes in Pandas:
| name | number |
|---|---|
| apple | 102 |
| apple | 104 |
| banana | 103 |
| banana | 105 |
and the other one (that's the real and true dataset of comparison)
| name | number |
|---|---|
| apple | 102 |
| banana | 105 |
I want to create another column to the first dataframe (called match) and put 0 if the number from first dataframe IS NOT in the second (and real) dataframe and 1 if it is. So basically, a left join, but to add a new column for seeing if the number is present in the other dataset.
The output should be:
| name | number | match |
|---|---|---|
| apple | 102 | 1 |
| apple | 104 | 0 |
| banana | 103 | 0 |
| banana | 105 | 1 |