I'm having a hell of a time trying to find an answer to this, which I feel like should be straight forward.

What is the Pandas equivalent of `SELECT * FROM [TABLE] WHERE [COL1] IN (LIST)`?

Basically, I have a large dataset of ID numbers, and I want to select a certain subset of these customers. I want the entire dataframe's worth of values. I tried using `.isin()`, but I do not want boolean values. Is there a simple way to use another Dataframe column/Series/list/tuple (whatever) to select rows in another Dataframe?

For example, I have two tables/DataFrames:

Let's call the first table **cust\_info**:

| cust\_id | metadata1 |
| --- | --- |
| 1234 | y |
| 5678 | x |
| 4321 | x |
| 2468 | y |
| 9513 | x |
| 1473 | y |

The second table will be called **cust\_orders**

| cust\_id | order\_date | order\_total |
| --- | --- | --- |
| 1234 | 2021-07-10 | 15.10 |
| 5678 | 2021-07-11 | 480.52 |
| 4321 | 2021-07-11 | 72.71 |
| 2468 | 2021-07-12 | 50.96 |
| 9513 | 2021-07-12 | 69.20 |
| 1473 | 2021-07-13 | 75.58 |

I'd like to use customers who's metadata1 value == 'y' in **cust\_info**. I've created a list (or Series, or Tuple, or Set, whatever I need) using `DF1[DF1['metadata1'] == 'y']` and extracting the cust\_id from that to create the list.

In this case, I want the entire row (including order\_date and order\_total) with cust\_id == [1234, 2468, 1473]

So the SQL equivalent would be:

```
SELECT * FROM [cust_orders]
WHERE [cust_id] in 
(
SELECT * FROM [cust_info] where [metadata1] = 'y'
) 

```

I know I can slice using AND/OR and &/|, but I have hundreds of values so manually typing each ID is out of the question. How would you guys do this? I feel like I'm missing something super obvious...

Thanks!