Hello, Im trying to select valuse from one table based on other table rows.
My current code use loop but its really slow on big tables and I want to find a way to make it more efficient.
My goal is to remove all the outliers from my data so I first calculate the quantiles and then loop them over the main table to find the matching rows. At the end I delete this rows.
Is there a way to use my conditional "Select Where" logic without looping? Maybe something like but with logic. thanks!
dt << Select Where( Contains( myList, :age ) );
disturbation_table = dt << Summary( Group( :NAME, :ENTITY ), Quantiles( 1, :VALUE ), Quantiles( 99, :VALUE ), Link to original data table( 0 ));
n_rows = NRow(disturbation_table);
//iterate all the disturbation data
For(i = 1, i <= n_rows, i++,
name_value = Column(disturbation_table, "NAME")[i];
entity_value = Column(disturbation_table, "ENTITY")[i];
QuantilesUp = Column(disturbation_table, "Quantiles99(VALUE)")[i];
QuantilesDown = Column(disturbation_table, "Quantiles1(VALUE)")[i];
try(
outliers_rows_to_delete = dt << Select Where(dt:NAME == name_value & dt:ENTITY == entity_value & (dt:VALUE >= QuantilesUp | dt:VALUE <= QuantilesDown), current selection("extend"));
);
);
dt << Delete Rows(outliers_rows_to_delete);