Expression ? Row Filter ?

HI
I dont find the right prompt to filter correctly what i want. This is an example of a small dataset.
I want to keep only the races (RNO) which have at least 14 starters (= POS 1 to 14).
In this example RN0 98 is the only one that must be retained.
14 RUNNERS.xlsx (10.3 KB)
Thanks for your help
Br

Hello @Brain
I see two possible outcomes for this challenge:

  1. The simple low code would be a Group Loop running on RNO field. and filtering max. POS >14 as output (the filtering can be done after loop end for simplification, by plotting max. POS constant value column for the group loop value).

  2. The ‘smart’ solution can be a ‘Expression’ node coded; dynamically ranged logical indexing for the max. POS > 14, avoiding loops.

For the second solution, I feel challenged to test it; as I’ve built similar solutions with the outdated ‘Column Expressions (legacy)’ node. And I had no time to experience with the more powerful updated node version.

I hope this suggestions can help you.

BR

2 Likes

Hi @Brain, another possibility is the following structure, if you are just wanting where there are at least 14 starters, but it doesn’t specifically require that POS=1 to 14. (e.g. If your dataset was POS=3 to 16, it would still match)

The GroupBy should be configured to GroupBy RNO and get a count of POS, which with your sample data would return this:

image

The Row Filter is configured to return only those rows where Count*(POS) >=14, which returns this:

image

And finally joining the original data set to the output of the Row Filter, joining on RNO = RNO returns all the rows for the filtered RNO:

edit: If you do require that POS=1 to 14+, and at least 14 starters, then you could modify the groupby to return Min(POS), Max(POS) and Count(POS), and then in the Row filter you’d also include that MIN*(POS) =1 and maybe Max(POS) >= 14 and so on, depending on your exact need.

4 Likes