How to filter Rows based on more than 200 unique values in a certain column?

Hi,

I am new to Knime. I have a table with several categories, and I want to separate the rows based on the columns’ unique values. I’ve already done it with the “RoW Filter” node, but because the number of unique values in that column exceeds 200, it’s inefficient.
Are there more efficient ways to filter rows without using 200 row filter nodes?
I also need to connect it to the python script after filtering the rows. The script creates two JSON outcome files. I removed python output port and saved the json files on my laptop and then used the “read JSON” node to upload the files; is there any way to define the output of the Python script as a JSON and then connect it to another node?

Here, I uploaded a workflow and sample of the data I have. The orginal data has around 200 unique top category values.
sampledata.txt (18.7 KB)
Break based on column values.knwf (25.1 KB)

Thanks

The Group Loop Node allows you to iterrate through a table based on grouping values. Then you can apply your transformation for each group.
br

3 Likes

Hi @NeginZarbakhsh, this workflow demonstrates what is mentioned by @Daniel_Weikert:

Break based on column values - iterations.knwf (63.2 KB)

Cheers

2 Likes

Hi Daniel,

Thanks,

My file is very big and I was thinking if I could separate rows based on their categories and save them separately in several tables so I could later apply my transformation to them.
I defined several paths to store them, but I’m not sure how I can use write to CSV before group loop end because I don’t have an output port. Do you have any suggestions?
2018 Manhttan.knwf (27.4 KB)

Thanks, for sharing the workflow.

I need to write the groups in different folders, I have already created several paths, but I am not sure how I should use “write to CSV” before the loop end. Do you suggest any nodes for this purpose as well?

Hello @NeginZarbakhsh ,

have a look at this example:

It should do what you need.

Leave a message if something is not clear. :slight_smile:
Have a nice day,

RB

3 Likes

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