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