Remove a given number of rows after each iteration in a loop

I have a dataframe with several columns.
Column1 is numeric with a values that ranges from 0 to 2.
I want to iteratively perform an operation to this dataframe, each time, reducing by X the number of samples for the highest and the lowest values.
For example purposes imagine this dataframe has 9 rows, and that the number of rows we want to remove is 2 (for the highest and the lowest). If the column 1 has the following values.

      Column1
Row1  0.2
Row2  0.5
Row3  0.6
Row4  0.7
Row5  1.2
Row6  1.2
Row7  1.3
Row8  1.9
Row9  1.9

The first iteration of the loop, we would do it with the whole dataset.
The second iteration would have the two highest and the two lowest values removed.
So we would perform it as following:

      Column1
Row3  0.6
Row4  0.7
Row5  1.2
Row6  1.2
Row7  1.3

And the third iteration would be done over:

      Column1
Row5  1.2

Hi @RoyBatty

This is something for the RecursiveLoop node. See Remove a given number of rows after each iteration in a loop.knwf (79.2 KB)


gr. Hans

5 Likes

Thanks @HansS However, how could I iterate though a column inside this loop? I explain it better in this post: Iterate through values inside a loop

1 Like

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