Intersect table of recipe with ingredients available

I have a table of recipe ingredients and want to match my list of meat and list of vegetables, to see what I can cook with current ingredients (list of meat and list of vegetables on another two tables with only one column each).

The table of recipe ingredients as follows:

recipe Meat 1 Meat 2 vege 1 vege 2 vege 3
1. beef egg onion garlic carrot
2. pork beef pepper corn carrot
3. fish pork soybean blackbean corn

List of meat = [‘egg’, fish’, ‘beef’, ‘pork’, ‘egg’, ‘fish’, ‘pork’, ‘chicken’] List of vegetables = [‘carrot’, ‘onion’, ‘corn’, ‘soybean’, ‘onion’, ‘garlic’, ‘soybean’, ‘redbean’, ‘blackbean’]

I am expecting following results:

recipe Meat 1 Meat 2 vege 1 vege 2 vege 3
1. beef egg onion garlic carrot
3. fish pork soybean blackbean corn

Result 2 (what are left remaining): List of meat = [‘egg’, ‘fish’, ‘pork’, ‘chicken’] List of vegetables = [‘onion’, ‘soybean’, ‘redbean’, ‘blackbean’]

Hello @anguslou

Have a look to this topic, this workflow can be easily adapted to your use case.

Please let us know if further advise is needed.

BR

2 Likes

Not only it works, but also much faster than for loop or intersection by Python. Thanks.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.