Pandas one-liner, f-string inside query
Intuition\nWe just want to count how many unique products customer bought and check if this is the number of all products (in this question we dont have to worr
# Intuition\nWe just want to count how many unique products customer bought and check if this is the number of all products (in this question we dont have to worry for products that were bought but are not included in product list, and dont have to worry about duplicates in product list)\n\n# Approach\nGroup by customer and count number of unique products. Then compare it with length of product list and if they are the same, we got customer who bought all products.\n\nwhat is worth noticing - we can use f-string as our query. Then inside such query, we can directly specify expression calculating length of product list.\n# Code\n```\nimport pandas as pd\n\ndef find_customers(customer: pd.DataFrame, product: pd.DataFrame) -> pd.DataFrame:\n    return customer.groupby("customer_id",as_index = False).product_key.nunique().query(f"product_key == {len(product)}")[["customer_id"]]\n```
['Pandas']