Read Data for Market Basket Analysis

Trying to read data for Market Basket Analysis.

Items sold are in different rows and want to combine then in to single row of items separated by comma.

Sample data:

Date Order_id Product
01-01-2018 1 yogurt
01-01-2018 1 pork
01-01-2018 1 sandwich bags
01-01-2018 2 shampoo
01-01-2018 2 hand soap
01-01-2018 2 waffles
01-01-2018 2 cheeses
02-01-2018 3 pork
02-01-2018 3 cheeses
02-01-2018 3 eggs
02-01-2018 4 cereals
02-01-2018 4 juice
02-01-2018 4 toilet paper
02-01-2018 4 all- purpose
02-01-2018 5 spaghetti sauce
02-01-2018 5 milk

Hi @dineshck4 and welcome to KNIME Community Forum,

You can use the GroupBy node. Include “Order_id” in the grouping column list. After that, in the aggregation tab, select “Product” column and then choose “list” as as the aggregation function.

There are two great example workflows for market basket analysis in KNIME Hub by @rs1:
Market Basket Analysis: Building Association Rules
Market Basket Analysis: Apply Association Rules



Thank you, Armin.

This worked and also the suggested projects are useful.

Much appreciated


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