New Column with concatenated values

Hello,

I have a dataset with cinema transactions from one cinema. I would like to make tree decision learner to predict which seats are attractive for customers. Therefore I would like to create a cell for each row and seat that has been ordered.

The problem is, that in most of the transactions the customer has bought more than one seat and the table looks like this:

Transaction Seats:
11/12-18 00:00:00 Row 1, Seat 1, 2
11/12-18 00:00:00 Row 2, Seat, 2, 4

I would like to create a table that looks like this, so I can see how many times each seat has been occupied:

Transaction Seats:
11/12-18 00:00:00 Row 1, seat 1
11/12-18 00:00:00 Row 1, seat 2
11/12-18 00:00:00 Row 2, seat 2
11/12-18 00:00:00 Row 2, seat 4

Hi @Dr-Donatello:

Here is a very clunky workflow that produces the requested results. It basically does a bunch of text manipulation steps so that an Unpivot node can be brought to bear on the data. If you are good with RegEx - unlike me! - you could do this in a much more straightforward way. There are a few reasons this is so clunky:

  1. I assumed the input rows are a single string that must be processed
  2. the delimiters in such a string are inconsistent (mix of spaces and commas)
  3. The number of seats can vary
  4. I avoided use of lists and collections

All of the above add certain complications. I also assumed that seats will only be purchased on a single row, which is probably not correct. Still, bearing all that in mind… it works.

2018-05-21%2013_22_15-KNIME%20Analytics%20Platform

2018-05-21%2013_22_24-Filtered%20table%20-%202_22_20%20-%20Column%20Filter

UnpivotingExample.knwf (26.3 KB)

1 Like

Hi @ScottF

I also tried to look at the RegEx for a short period, but I’m like you and cannot figure out how to use that one.

But clunky or not - the workflow that you created did EXACTLY what I was looking for!
Thank you very much for your time and help with this - now I can finish what I started :smiley:

I hope you have a very nice day :slight_smile:

Great! Glad it helped you.

1 Like

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