Loop Node - Execution

I have 57 columns in my data set. And I must run a groupby on each column to find out the unique values along with its Count for each column.
I am finding it harder to apply Groupby for each column.

I came across loop node. I am not even sure whether Loop is the Solution. If yes, Could you tell me how to apply it

Is there any efficient way to do this task?

Thanks

Hi @suseearun you could potentially use a Column List Loop and perform a groupby within the loop, but it can be a bit fiddly, and also relatively inefficient (because it is a loop!)

For your task, you could instead do this:

Here I want to find the total unique values in column1, column2,column3 and column4, and ignore column5 and column6.

So I unpivot, telling it my “value columns” are columns1…4 and my “retained columns” are column5,6

This then returns me a table which is easy to use GroupBy on, because I can now group by the ColumnNames and get a “unique count” of the ColumnValues, along with a Set (which is the unique values):

You could alternatively return “Unique Concatenate with count” from the group by, which gives you the same result but in a single string.

1 Like

Predictive Analytics Customers.xlsx (868.6 KB)

This is the file . I need to run group on each column.

For eg, If I run groupby on gender output table looks something like below

M 20
F 30

I need value like this for each column.

I did try this, but it is not what i need. I have attached the file above and I am attaching the result excel here.

Test.xlsx (4.7 KB)

Hi @suseearun ,

You can give the Statistics node a try, paying attention to the output at the third output port.

4 Likes

Perfect. Thank you so much.

Hi @suseearun, I now better understand what you were asking as I thought you simply wanted a count of the number of different values, along with a list of the different values. Its much easier to visualise once there is an example. :wink:

I think @tomljh 's solution gets you precisely what you need, so please remember to mark @tomljh 's post as the solution. That way people can see that it has been solved. thanks :slight_smile:

3 Likes

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