我有两个包含 state 和 regionname 列的数据框,我正在尝试查看 df2 是否在 df1 中,并将该列添加到 df3
df1=
+--------------+------------+------+
| State | RegionName | Data |
+--------------+------------+------+
| New York | New York | 123 |
| Jacksonville | Florida | ABC |
+--------------+------------+------+
df2=
+--------------+------------+------+
| State | RegionName | Data |
+--------------+------------+------+
| New York | New York | 456 |
+--------------+------------+------+
Output would be df3=
+--------------+------------+------+-------+
| State | RegionName | Data | IsIn2 |
+--------------+------------+------+-------+
| New York | New York | 123 | 1 |
| Jacksonville | Florida | ABC | 0 |
+--------------+------------+------+-------+