2021: Week 7 - Vegan Shopping List

Challenge by: Jonathan Allenby

Now that Veganuary has come and gone we thought it would be interesting to take a look at some common supermarket products and use Prep to figure out whether or not they are vegan. Some results may surprise you!

For the sake of this analysis we're taking bee by-products as non-vegan (beeswax, honey, etc).

Inputs

  1. A shopping list of products and their ingredients (or allergens when ingredients were not available). I have a child-like palate so its mostly full of sweet treats, some of which you'd expect to be vegan and some of which you'd expect not to be, however everything is commonly found in UK supermarkets so no specialist shops required.



  2. Two lists of common non-vegan ingredients and E numbers (source)

Requirements

  • Input the data
  • Prepare the keyword data
    • Add an 'E' in front of every E number.
    • Stack Animal Ingredients and E Numbers on top of each other.
    • Get every ingredient and E number onto separate rows.
  • Append the keywords onto the product list.
  • Check whether each product contains any non-vegan ingredients.
  • Prepare a final shopping list of vegan products.
    • Aggregate the products into vegan and non-vegan.
    • Filter out the non-vegan products.
  • Prepare a list explaining why the other products aren't vegan.
    • Keep only non-vegan products.
    • Duplicate the keyword field.
    • Rows to columns pivot the keywords using the duplicate as a header.
    • Write a calculation to concatenate all the keywords into a single comma-separated list for each product, e.g. "whey, milk, egg".
  • Output the data.

Outputs

  • Vegan Shopping List
    • Product
    • Description
    • 20 rows (21 including headers)

  • Non Vegan List
    • Product
    • Description
    • Contains
    • 19 rows (20 including headers)


The full outputs can be downloaded here: 1. Vegan List and 2. Non-Vegan List.

After you finish the challenge make sure to fill in the participation tracker, then share your solution on Twitter using #PreppinData and tagging @Datajedininja@JennyMartinDS14 & @TomProwse1

You can also post your solution on the Tableau Forum where we have a Preppin' Data community page. Post your solutions and ask questions if you need any help! 

Popular posts from this blog

2023: Week 1 The Data Source Bank

2023: Week 2 - International Bank Account Numbers

How to...Handle Free Text